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
- TextRangeSerialization.cs
- DictionaryKeyPropertyAttribute.cs
- CollectionDataContract.cs
- TextContainerHelper.cs
- ASCIIEncoding.cs
- CustomCredentialPolicy.cs
- ScaleTransform3D.cs
- DbInsertCommandTree.cs
- HttpServerVarsCollection.cs
- ImmutableObjectAttribute.cs
- HttpMethodAttribute.cs
- UnitySerializationHolder.cs
- MimeBasePart.cs
- XmlEntityReference.cs
- FormViewInsertedEventArgs.cs
- PrinterUnitConvert.cs
- Soap12ProtocolReflector.cs
- UIAgentMonitor.cs
- ListViewItem.cs
- Model3DGroup.cs
- SqlFunctionAttribute.cs
- FixedTextBuilder.cs
- XamlReaderHelper.cs
- GlyphsSerializer.cs
- URL.cs
- DataServiceQueryOfT.cs
- ListView.cs
- XmlSchema.cs
- BinaryKeyIdentifierClause.cs
- LineServices.cs
- NativeStructs.cs
- BooleanFunctions.cs
- ACE.cs
- IDQuery.cs
- HeaderUtility.cs
- IconConverter.cs
- assertwrapper.cs
- InternalException.cs
- VirtualizingStackPanel.cs
- ListViewSortEventArgs.cs
- SimpleTypesSurrogate.cs
- sqlinternaltransaction.cs
- TransformerInfo.cs
- TagNameToTypeMapper.cs
- HttpBrowserCapabilitiesBase.cs
- XsltSettings.cs
- SignatureResourcePool.cs
- ExceptionValidationRule.cs
- StringResourceManager.cs
- Stack.cs
- Crypto.cs
- UIPropertyMetadata.cs
- filewebresponse.cs
- ProfilePropertyMetadata.cs
- GetIndexBinder.cs
- parserscommon.cs
- ErrorStyle.cs
- ControlBuilder.cs
- DataMemberListEditor.cs
- RotateTransform3D.cs
- DeflateEmulationStream.cs
- SessionPageStatePersister.cs
- TreeNodeStyleCollection.cs
- CaseCqlBlock.cs
- LabelDesigner.cs
- BitHelper.cs
- ManagementEventWatcher.cs
- SponsorHelper.cs
- XmlNodeComparer.cs
- Decimal.cs
- RectangleHotSpot.cs
- Int32EqualityComparer.cs
- MSAAWinEventWrap.cs
- IndividualDeviceConfig.cs
- FormsAuthenticationCredentials.cs
- SimpleHandlerFactory.cs
- ConfigurationManager.cs
- UrlMappingsSection.cs
- SafeSecurityHandles.cs
- Converter.cs
- RelationshipEntry.cs
- DataControlPagerLinkButton.cs
- PrtTicket_Base.cs
- PrintController.cs
- PageAsyncTaskManager.cs
- C14NUtil.cs
- XmlCompatibilityReader.cs
- ZoomPercentageConverter.cs
- BindingExpressionUncommonField.cs
- DeviceContext.cs
- SafeTimerHandle.cs
- SoapClientMessage.cs
- DataControlButton.cs
- LazyTextWriterCreator.cs
- HtmlElementCollection.cs
- PrePostDescendentsWalker.cs
- SqlCommandSet.cs
- SqlPersonalizationProvider.cs
- RadioButtonAutomationPeer.cs
- DBCSCodePageEncoding.cs