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
- RedistVersionInfo.cs
- AdRotatorDesigner.cs
- PreservationFileWriter.cs
- CheckBoxPopupAdapter.cs
- OdbcTransaction.cs
- StringTraceRecord.cs
- TypedReference.cs
- ProtectedUri.cs
- HttpProfileBase.cs
- WebPartHelpVerb.cs
- ObjectSecurity.cs
- AspNetHostingPermission.cs
- MessageHeaderException.cs
- FormsAuthenticationCredentials.cs
- DataBoundControl.cs
- NGCSerializerAsync.cs
- StorageAssociationSetMapping.cs
- ListBoxDesigner.cs
- ECDsa.cs
- HttpException.cs
- AnimationTimeline.cs
- XmlParser.cs
- DictationGrammar.cs
- Event.cs
- HwndKeyboardInputProvider.cs
- RuntimeCompatibilityAttribute.cs
- ParenthesizePropertyNameAttribute.cs
- CompositeActivityTypeDescriptorProvider.cs
- UserControl.cs
- CollectionViewGroupRoot.cs
- xsdvalidator.cs
- ClientConfigurationSystem.cs
- CodeSnippetCompileUnit.cs
- XmlSchemaComplexContent.cs
- ApplicationFileCodeDomTreeGenerator.cs
- BufferBuilder.cs
- UIElementIsland.cs
- ThreadStateException.cs
- Array.cs
- ReachDocumentReferenceCollectionSerializerAsync.cs
- EventsTab.cs
- NavigatorOutput.cs
- WinEventWrap.cs
- BitmapEncoder.cs
- ColorAnimation.cs
- UInt64Storage.cs
- MediaElement.cs
- StyleXamlParser.cs
- MdbDataFileEditor.cs
- CustomLineCap.cs
- TemplateField.cs
- PresentationAppDomainManager.cs
- OutputCacheProfileCollection.cs
- TextSimpleMarkerProperties.cs
- ColorPalette.cs
- XmlIterators.cs
- BmpBitmapEncoder.cs
- SystemIPInterfaceProperties.cs
- PresentationTraceSources.cs
- WithParamAction.cs
- serverconfig.cs
- ReliableReplySessionChannel.cs
- Page.cs
- DeviceSpecificChoiceCollection.cs
- GeometryValueSerializer.cs
- IisTraceWebEventProvider.cs
- ManagementInstaller.cs
- SQLChars.cs
- CategoryNameCollection.cs
- WebPartMenuStyle.cs
- peernodestatemanager.cs
- StringToken.cs
- UpdateRecord.cs
- GPPOINTF.cs
- PlainXmlWriter.cs
- ToggleButtonAutomationPeer.cs
- CatalogPartChrome.cs
- InitializerFacet.cs
- WindowsToolbarAsMenu.cs
- CodeLabeledStatement.cs
- SystemKeyConverter.cs
- BufferAllocator.cs
- HtmlInputText.cs
- _UriTypeConverter.cs
- Oid.cs
- BuilderElements.cs
- DataGridTable.cs
- ExpressionConverter.cs
- XamlTypeMapper.cs
- HttpListenerTimeoutManager.cs
- MinimizableAttributeTypeConverter.cs
- ZipArchive.cs
- RegexWriter.cs
- XPathEmptyIterator.cs
- InputElement.cs
- SqlDataSourceCommandParser.cs
- DtrList.cs
- TextSerializer.cs
- UnauthorizedAccessException.cs
- UserControlBuildProvider.cs