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
- PowerEase.cs
- ToolboxControl.cs
- XmlWrappingWriter.cs
- Stroke2.cs
- PathFigure.cs
- EncodingNLS.cs
- TextChange.cs
- ThreadInterruptedException.cs
- TextControlDesigner.cs
- XPathNodeHelper.cs
- WindowsComboBox.cs
- GeometryCollection.cs
- ApplicationFileParser.cs
- ConfigurationProperty.cs
- InvokeMethod.cs
- AvTraceDetails.cs
- SetStoryboardSpeedRatio.cs
- SafeTokenHandle.cs
- StringArrayEditor.cs
- DrawListViewItemEventArgs.cs
- BlobPersonalizationState.cs
- WebMessageFormatHelper.cs
- ResourceReferenceKeyNotFoundException.cs
- FontFamilyValueSerializer.cs
- UrlMappingsSection.cs
- DataGridViewRowStateChangedEventArgs.cs
- SimpleBitVector32.cs
- EditorPart.cs
- DataGridViewCellFormattingEventArgs.cs
- SQLMembershipProvider.cs
- WebPartConnectionsCancelVerb.cs
- Dispatcher.cs
- JapaneseCalendar.cs
- Parallel.cs
- SingleAnimationUsingKeyFrames.cs
- RoleBoolean.cs
- PanelStyle.cs
- EnumCodeDomSerializer.cs
- CreateUserWizard.cs
- PersistenceMetadataNamespace.cs
- SessionStateContainer.cs
- EntityDataSourceDesigner.cs
- FontInfo.cs
- DictationGrammar.cs
- XmlDataLoader.cs
- Pen.cs
- SingleSelectRootGridEntry.cs
- ServiceModelActivationSectionGroup.cs
- AssemblyEvidenceFactory.cs
- Condition.cs
- GeneralTransform3D.cs
- TextRange.cs
- PointAnimationUsingPath.cs
- UnsafeNativeMethods.cs
- UrlMapping.cs
- EasingQuaternionKeyFrame.cs
- FontFamilyConverter.cs
- ToolboxItem.cs
- EditorPartChrome.cs
- XmlQueryContext.cs
- TransformedBitmap.cs
- Run.cs
- SchemaExporter.cs
- LingerOption.cs
- FloatSumAggregationOperator.cs
- _IPv6Address.cs
- PropertyGridView.cs
- ToolStripDesignerAvailabilityAttribute.cs
- StringCollectionMarkupSerializer.cs
- MemberRelationshipService.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- SqlDataSourceQuery.cs
- ServiceHostFactory.cs
- DockPattern.cs
- ImageBrush.cs
- UriSectionReader.cs
- BoundingRectTracker.cs
- TrackPointCollection.cs
- Image.cs
- SymbolDocumentInfo.cs
- GridSplitter.cs
- SBCSCodePageEncoding.cs
- DateTimeFormatInfo.cs
- SmtpReplyReader.cs
- shaperfactoryquerycacheentry.cs
- DataGridPagingPage.cs
- EmptyControlCollection.cs
- TemplateBindingExtension.cs
- DocumentAutomationPeer.cs
- OutputBuffer.cs
- SQLRoleProvider.cs
- SqlTriggerAttribute.cs
- RijndaelManaged.cs
- DeleteIndexBinder.cs
- TemplateBindingExtension.cs
- DataRowView.cs
- log.cs
- CacheSection.cs
- fixedPageContentExtractor.cs
- RegexTypeEditor.cs