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
- PasswordRecovery.cs
- ListControlConvertEventArgs.cs
- PrivilegedConfigurationManager.cs
- AnnotationAdorner.cs
- Viewport2DVisual3D.cs
- validation.cs
- MD5CryptoServiceProvider.cs
- XmlSchemaAny.cs
- xmlfixedPageInfo.cs
- DocobjHost.cs
- KeyProperty.cs
- BindingSource.cs
- _ListenerAsyncResult.cs
- TextPointerBase.cs
- UInt32Converter.cs
- ListViewHitTestInfo.cs
- InfoCardTrace.cs
- XmlTextEncoder.cs
- ListViewDeletedEventArgs.cs
- NumberFormatInfo.cs
- WS2007HttpBindingCollectionElement.cs
- WebRequestModuleElementCollection.cs
- ShaperBuffers.cs
- UriParserTemplates.cs
- controlskin.cs
- IncrementalReadDecoders.cs
- DataAccessor.cs
- ThreadExceptionEvent.cs
- DataGridItemEventArgs.cs
- EncryptedKeyIdentifierClause.cs
- typedescriptorpermissionattribute.cs
- COM2IDispatchConverter.cs
- X509Utils.cs
- ConfigurationSection.cs
- AutomationProperties.cs
- BamlLocalizer.cs
- WebServiceErrorEvent.cs
- SHA256Cng.cs
- TextComposition.cs
- GroupBox.cs
- ClickablePoint.cs
- InputScope.cs
- Matrix.cs
- HostProtectionPermission.cs
- TextServicesProperty.cs
- Context.cs
- DataBindingCollectionEditor.cs
- CannotUnloadAppDomainException.cs
- ScriptHandlerFactory.cs
- DataGridViewTopRowAccessibleObject.cs
- ToolStripLocationCancelEventArgs.cs
- GroupBox.cs
- DirectoryNotFoundException.cs
- CachedResourceDictionaryExtension.cs
- WebPartAddingEventArgs.cs
- BindingObserver.cs
- Geometry.cs
- CompoundFileIOPermission.cs
- Relationship.cs
- DetailsViewRowCollection.cs
- _LoggingObject.cs
- UIElementHelper.cs
- GroupBox.cs
- PermissionSetEnumerator.cs
- UiaCoreApi.cs
- DelayedRegex.cs
- DynamicRendererThreadManager.cs
- DBParameter.cs
- WebPartAuthorizationEventArgs.cs
- InvokePattern.cs
- HttpVersion.cs
- SqlCommand.cs
- CellPartitioner.cs
- ListViewItemMouseHoverEvent.cs
- ChangeConflicts.cs
- JsonServiceDocumentSerializer.cs
- WaitHandleCannotBeOpenedException.cs
- ListItemCollection.cs
- DataMisalignedException.cs
- Directory.cs
- PreloadedPackages.cs
- GlobalItem.cs
- MaskedTextProvider.cs
- PropertyToken.cs
- TPLETWProvider.cs
- BaseTemplatedMobileComponentEditor.cs
- TableAutomationPeer.cs
- RangeValuePattern.cs
- ScriptModule.cs
- FrameAutomationPeer.cs
- ItemCollectionEditor.cs
- IndentedWriter.cs
- RectAnimation.cs
- WebBrowserSiteBase.cs
- ProcessHostMapPath.cs
- SessionViewState.cs
- BaseCodePageEncoding.cs
- GreenMethods.cs
- StrokeCollectionConverter.cs
- TextProviderWrapper.cs