Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / clr / src / BCL / System / Security / Cryptography / DSASignatureDeformatter.cs / 1 / DSASignatureDeformatter.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // DSASignatureDeformatter.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class DSASignatureDeformatter : AsymmetricSignatureDeformatter { DSA _dsaKey; // DSA Key value to do decrypt operation string _oid; // // public constructors // public DSASignatureDeformatter() { // The hash algorithm is always SHA1 _oid = CryptoConfig.MapNameToOID("SHA1"); } public DSASignatureDeformatter(AsymmetricAlgorithm key) : this() { if (key == null) throw new ArgumentNullException("key"); _dsaKey = (DSA) key; } // // public methods // public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); _dsaKey = (DSA) key; } public override void SetHashAlgorithm(string strName) { if (CryptoConfig.MapNameToOID(strName) != _oid) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_InvalidOperation")); } public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); if (rgbHash == null) throw new ArgumentNullException("rgbHash"); if (rgbSignature == null) throw new ArgumentNullException("rgbSignature"); return _dsaKey.VerifySignature(rgbHash, rgbSignature); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // // DSASignatureDeformatter.cs // namespace System.Security.Cryptography { [System.Runtime.InteropServices.ComVisible(true)] public class DSASignatureDeformatter : AsymmetricSignatureDeformatter { DSA _dsaKey; // DSA Key value to do decrypt operation string _oid; // // public constructors // public DSASignatureDeformatter() { // The hash algorithm is always SHA1 _oid = CryptoConfig.MapNameToOID("SHA1"); } public DSASignatureDeformatter(AsymmetricAlgorithm key) : this() { if (key == null) throw new ArgumentNullException("key"); _dsaKey = (DSA) key; } // // public methods // public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); _dsaKey = (DSA) key; } public override void SetHashAlgorithm(string strName) { if (CryptoConfig.MapNameToOID(strName) != _oid) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_InvalidOperation")); } public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature) { if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); if (rgbHash == null) throw new ArgumentNullException("rgbHash"); if (rgbSignature == null) throw new ArgumentNullException("rgbSignature"); return _dsaKey.VerifySignature(rgbHash, rgbSignature); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProgressBarAutomationPeer.cs
- HostUtils.cs
- TextShapeableCharacters.cs
- Operator.cs
- URLAttribute.cs
- unsafenativemethodsother.cs
- WebPartConnectionsCancelVerb.cs
- SecurityException.cs
- XmlKeywords.cs
- StorageAssociationSetMapping.cs
- TaskFileService.cs
- OletxCommittableTransaction.cs
- GeneralTransform2DTo3DTo2D.cs
- StylusPoint.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- CalendarBlackoutDatesCollection.cs
- BinaryMethodMessage.cs
- HierarchicalDataBoundControlAdapter.cs
- UnauthorizedAccessException.cs
- DataGridViewIntLinkedList.cs
- Int32Storage.cs
- FtpCachePolicyElement.cs
- XpsStructure.cs
- VisualStateGroup.cs
- HttpCachePolicyElement.cs
- IUnknownConstantAttribute.cs
- StringDictionaryEditor.cs
- BitmapPalette.cs
- WebPartEditorApplyVerb.cs
- AmbientLight.cs
- MulticastDelegate.cs
- DataListItemCollection.cs
- LogicalExpressionTypeConverter.cs
- UIElement.cs
- EventWaitHandle.cs
- ActiveXContainer.cs
- HtmlGenericControl.cs
- ComponentCodeDomSerializer.cs
- RoleManagerSection.cs
- SQLGuidStorage.cs
- CharAnimationBase.cs
- XmlILConstructAnalyzer.cs
- ApplicationSecurityInfo.cs
- TraceListeners.cs
- FileCodeGroup.cs
- WhitespaceRuleReader.cs
- BoolExpr.cs
- SafeFindHandle.cs
- GenericRootAutomationPeer.cs
- HtmlInputHidden.cs
- InlineObject.cs
- EntityContainerRelationshipSetEnd.cs
- Vector3DCollectionConverter.cs
- CellParaClient.cs
- SynchronizingStream.cs
- DataGridTextBoxColumn.cs
- SiteIdentityPermission.cs
- SqlDataSourceSelectingEventArgs.cs
- StringFunctions.cs
- DbModificationCommandTree.cs
- TdsEnums.cs
- Domain.cs
- NewItemsContextMenuStrip.cs
- BlockingCollection.cs
- DescriptionAttribute.cs
- QuestionEventArgs.cs
- SerializationStore.cs
- SqlNode.cs
- XmlDataLoader.cs
- TextEmbeddedObject.cs
- Compiler.cs
- AxWrapperGen.cs
- ListViewDeletedEventArgs.cs
- ISFClipboardData.cs
- HashAlgorithm.cs
- ColorConvertedBitmap.cs
- AdjustableArrowCap.cs
- TabItemAutomationPeer.cs
- ConfigurationCollectionAttribute.cs
- PropertiesTab.cs
- MessageBox.cs
- AuthenticationManager.cs
- GuidConverter.cs
- DBSqlParserTable.cs
- SmtpReplyReaderFactory.cs
- storepermissionattribute.cs
- dataSvcMapFileLoader.cs
- bindurihelper.cs
- itemelement.cs
- SqlWebEventProvider.cs
- CustomMenuItemCollection.cs
- ObjectListCommandsPage.cs
- SqlDataSourceCommandEventArgs.cs
- DockPattern.cs
- SiteMapDataSource.cs
- WinEventWrap.cs
- TemplatePropertyEntry.cs
- SpellerHighlightLayer.cs
- Asn1IntegerConverter.cs
- VerticalConnector.xaml.cs