Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- QilScopedVisitor.cs
- EncodedStreamFactory.cs
- SchemaImporterExtensionsSection.cs
- Form.cs
- ScrollChrome.cs
- FormViewUpdateEventArgs.cs
- AutomationPatternInfo.cs
- HwndSubclass.cs
- SR.Designer.cs
- ConnectionConsumerAttribute.cs
- ConnectionStringSettingsCollection.cs
- Comparer.cs
- FamilyCollection.cs
- ModelItemCollection.cs
- ApplicationFileParser.cs
- PackagePartCollection.cs
- SecurityDescriptor.cs
- JsonEnumDataContract.cs
- StateMachine.cs
- FormsAuthentication.cs
- TextTreeFixupNode.cs
- ProfileProvider.cs
- LayoutDump.cs
- login.cs
- SerializerProvider.cs
- FastEncoderWindow.cs
- AnnotationAuthorChangedEventArgs.cs
- PenCursorManager.cs
- ParseNumbers.cs
- TextEditorDragDrop.cs
- GuidelineSet.cs
- UnhandledExceptionEventArgs.cs
- BinaryNode.cs
- ComponentEvent.cs
- safex509handles.cs
- ListItemCollection.cs
- InternalBufferOverflowException.cs
- RemotingServices.cs
- PropertyMetadata.cs
- SqlException.cs
- ObjectTag.cs
- ConfigurationManagerInternalFactory.cs
- SecurityUtils.cs
- InvalidPrinterException.cs
- ButtonChrome.cs
- XamlVector3DCollectionSerializer.cs
- ButtonBase.cs
- MultiSelectRootGridEntry.cs
- KeyboardDevice.cs
- XmlSiteMapProvider.cs
- HtmlHead.cs
- XmlElementAttributes.cs
- ToolboxComponentsCreatedEventArgs.cs
- StatusBarItem.cs
- MatrixAnimationUsingKeyFrames.cs
- PagedDataSource.cs
- RoutedPropertyChangedEventArgs.cs
- HealthMonitoringSectionHelper.cs
- DataGridViewUtilities.cs
- Terminate.cs
- HuffCodec.cs
- Renderer.cs
- CollectionBuilder.cs
- ServiceModelActivity.cs
- SQLRoleProvider.cs
- Encoding.cs
- ActivationWorker.cs
- RSAPKCS1SignatureDeformatter.cs
- GlobalProxySelection.cs
- HyperLinkColumn.cs
- RawStylusInput.cs
- MD5.cs
- RuntimeConfigLKG.cs
- SqlCommandSet.cs
- PersonalizationProvider.cs
- LexicalChunk.cs
- LookupBindingPropertiesAttribute.cs
- LocatorPart.cs
- infer.cs
- FormViewPagerRow.cs
- ValueUnavailableException.cs
- UdpDuplexChannel.cs
- XmlSchemaSequence.cs
- ObfuscationAttribute.cs
- LiteralControl.cs
- XmlSequenceWriter.cs
- GeometryDrawing.cs
- XmlSchema.cs
- ElementNotAvailableException.cs
- WindowsPen.cs
- GPPOINTF.cs
- ToolStripOverflow.cs
- SettingsContext.cs
- TextParagraphProperties.cs
- MessageDecoder.cs
- StoragePropertyMapping.cs
- XmlValidatingReaderImpl.cs
- SizeConverter.cs
- PrintController.cs
- TypedElement.cs