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
- DataBindingExpressionBuilder.cs
- SHA1Cng.cs
- MemberMaps.cs
- DataGridViewEditingControlShowingEventArgs.cs
- JoinGraph.cs
- SharedDp.cs
- TableLayoutPanelCellPosition.cs
- XmlIterators.cs
- Image.cs
- FacetDescriptionElement.cs
- ActiveXMessageFormatter.cs
- IdnElement.cs
- cookie.cs
- TextEditorLists.cs
- PowerModeChangedEventArgs.cs
- TabControlAutomationPeer.cs
- GridViewItemAutomationPeer.cs
- WorkflowItemsPresenter.cs
- X509AudioLogo.cs
- SymmetricAlgorithm.cs
- HttpCacheVaryByContentEncodings.cs
- Tablet.cs
- SystemUnicastIPAddressInformation.cs
- FormsAuthenticationModule.cs
- PasswordPropertyTextAttribute.cs
- TransformedBitmap.cs
- ForAllOperator.cs
- ServiceSettingsResponseInfo.cs
- AlignmentYValidation.cs
- DataSourceCacheDurationConverter.cs
- CellRelation.cs
- WebPartHelpVerb.cs
- XmlQueryContext.cs
- TraversalRequest.cs
- Unit.cs
- StreamSecurityUpgradeInitiatorBase.cs
- smtpconnection.cs
- UnauthorizedAccessException.cs
- DragCompletedEventArgs.cs
- GridViewColumnCollectionChangedEventArgs.cs
- sqlser.cs
- DrawingAttributesDefaultValueFactory.cs
- BooleanToVisibilityConverter.cs
- RotateTransform3D.cs
- EdgeProfileValidation.cs
- CloudCollection.cs
- UdpAnnouncementEndpoint.cs
- RetrieveVirtualItemEventArgs.cs
- SynchronizationContextHelper.cs
- TypeViewSchema.cs
- SoapIncludeAttribute.cs
- XmlTextEncoder.cs
- SqlDataSourceConfigureFilterForm.cs
- BaseUriWithWildcard.cs
- MimeParameterWriter.cs
- BooleanKeyFrameCollection.cs
- DeviceSpecificChoiceCollection.cs
- URLString.cs
- SerTrace.cs
- PropertyAccessVisitor.cs
- DiagnosticsConfigurationHandler.cs
- KeyInstance.cs
- TableDetailsCollection.cs
- LogSwitch.cs
- PersonalizationStateInfo.cs
- ExpressionNode.cs
- EndpointConfigContainer.cs
- RectangleConverter.cs
- CultureInfoConverter.cs
- TransformPatternIdentifiers.cs
- JsonDataContract.cs
- SchemaManager.cs
- ApplicationProxyInternal.cs
- DataKeyArray.cs
- FamilyMapCollection.cs
- AttributeProviderAttribute.cs
- XsltCompileContext.cs
- DecimalConverter.cs
- TextDecorations.cs
- ExpandedProjectionNode.cs
- AuthenticatedStream.cs
- RenderContext.cs
- Control.cs
- DataViewManager.cs
- ValidatingReaderNodeData.cs
- PageContent.cs
- GenericAuthenticationEventArgs.cs
- DropTarget.cs
- Size.cs
- ColumnResult.cs
- PopupEventArgs.cs
- VisualState.cs
- ProfileEventArgs.cs
- SqlDependency.cs
- SafeNativeMethodsCLR.cs
- PageCache.cs
- DrawingDrawingContext.cs
- ProgressBarBrushConverter.cs
- RootBrowserWindowProxy.cs
- SmtpFailedRecipientException.cs