Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- MatrixCamera.cs
- CompilerHelpers.cs
- StringInfo.cs
- StylusCollection.cs
- CheckBoxAutomationPeer.cs
- ClassicBorderDecorator.cs
- DataBoundControlHelper.cs
- PageSettings.cs
- DirectionalLight.cs
- odbcmetadatacolumnnames.cs
- DBNull.cs
- TraceContext.cs
- DataGridViewCellValueEventArgs.cs
- SoapObjectWriter.cs
- NonParentingControl.cs
- ApplicationGesture.cs
- QilFactory.cs
- XPathNode.cs
- ClientApiGenerator.cs
- Matrix.cs
- CommittableTransaction.cs
- SafeViewOfFileHandle.cs
- Hash.cs
- MultiplexingFormatMapping.cs
- HtmlTitle.cs
- ResourceReader.cs
- SqlException.cs
- RoleManagerEventArgs.cs
- DesignerTransaction.cs
- RectAnimationUsingKeyFrames.cs
- AuthenticationService.cs
- XmlSchemaValidator.cs
- DefaultValueConverter.cs
- smtppermission.cs
- RemoteDebugger.cs
- TextShapeableCharacters.cs
- VisemeEventArgs.cs
- SerializationSectionGroup.cs
- ControllableStoryboardAction.cs
- IPipelineRuntime.cs
- ApplicationException.cs
- CompiledIdentityConstraint.cs
- DiscardableAttribute.cs
- TextRangeAdaptor.cs
- InternalPermissions.cs
- GeometryGroup.cs
- HMACRIPEMD160.cs
- ScrollItemPatternIdentifiers.cs
- SourceCollection.cs
- CellConstantDomain.cs
- QilXmlReader.cs
- PageRequestManager.cs
- ResourceReader.cs
- _PooledStream.cs
- PrivilegedConfigurationManager.cs
- EncryptedXml.cs
- AutomationElementCollection.cs
- XmlElementAttribute.cs
- CatalogZone.cs
- DescendantOverDescendantQuery.cs
- ProxyAssemblyNotLoadedException.cs
- DivideByZeroException.cs
- x509utils.cs
- ValidationEventArgs.cs
- SignedXmlDebugLog.cs
- WebPartsPersonalizationAuthorization.cs
- PlatformCulture.cs
- ServiceDescriptionSerializer.cs
- Simplifier.cs
- FlatButtonAppearance.cs
- TypedTableGenerator.cs
- MemoryRecordBuffer.cs
- Highlights.cs
- QuaternionValueSerializer.cs
- securitycriticaldataClass.cs
- XmlSchemaDatatype.cs
- HotSpot.cs
- QueryContinueDragEventArgs.cs
- TraceSection.cs
- SQLGuidStorage.cs
- TreeChangeInfo.cs
- SqlDataSourceStatusEventArgs.cs
- BuildProvidersCompiler.cs
- SafeUserTokenHandle.cs
- AutoCompleteStringCollection.cs
- NamespaceDecl.cs
- MethodAccessException.cs
- ConfigXmlSignificantWhitespace.cs
- DataListItemCollection.cs
- XmlSubtreeReader.cs
- DataRecord.cs
- EndpointAddressMessageFilterTable.cs
- SafeNativeMethods.cs
- TriState.cs
- precedingsibling.cs
- EmbeddedObject.cs
- PrintingPermission.cs
- WebRequestModuleElementCollection.cs
- WindowsGraphics2.cs
- PreProcessInputEventArgs.cs