Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- HtmlValidatorAdapter.cs
- ListControl.cs
- TypeConverterHelper.cs
- LazyTextWriterCreator.cs
- TreeNode.cs
- BamlLocalizer.cs
- DefaultBindingPropertyAttribute.cs
- AVElementHelper.cs
- AppSettingsExpressionEditor.cs
- ComEventsMethod.cs
- Table.cs
- UnsafeNativeMethods.cs
- RuntimeArgumentHandle.cs
- PointAnimationClockResource.cs
- PrintController.cs
- TextTrailingCharacterEllipsis.cs
- DependencyProperty.cs
- Misc.cs
- MobilePage.cs
- GraphicsPathIterator.cs
- ListItemCollection.cs
- ClientFormsIdentity.cs
- HeaderUtility.cs
- MenuScrollingVisibilityConverter.cs
- CheckBox.cs
- X509AsymmetricSecurityKey.cs
- BoolExpr.cs
- OleDbDataAdapter.cs
- SharedPersonalizationStateInfo.cs
- ScrollItemProviderWrapper.cs
- DurableInstance.cs
- DCSafeHandle.cs
- ToolBarOverflowPanel.cs
- ObjectRef.cs
- COM2Enum.cs
- DataTablePropertyDescriptor.cs
- PropertyChangedEventArgs.cs
- BufferedOutputStream.cs
- _SpnDictionary.cs
- HttpListenerRequest.cs
- ProbeMatchesApril2005.cs
- DoubleAnimation.cs
- WindowsRegion.cs
- CommonDialog.cs
- DBCommandBuilder.cs
- Query.cs
- AutoResetEvent.cs
- GridViewAutomationPeer.cs
- HtmlInputFile.cs
- EntityContainerRelationshipSetEnd.cs
- PriorityQueue.cs
- BitmapFrameDecode.cs
- SqlNodeAnnotation.cs
- TextInfo.cs
- DocumentsTrace.cs
- MimeMultiPart.cs
- ProvidePropertyAttribute.cs
- PathData.cs
- xamlnodes.cs
- XmlDocumentSurrogate.cs
- ToolStripItemGlyph.cs
- MessageQueueCriteria.cs
- ModuleBuilder.cs
- SchemaTypeEmitter.cs
- XmlSchemaAny.cs
- OpacityConverter.cs
- initElementDictionary.cs
- CaseStatementSlot.cs
- ContractNamespaceAttribute.cs
- BaseResourcesBuildProvider.cs
- ReaderWriterLock.cs
- NominalTypeEliminator.cs
- ProfileInfo.cs
- ByteConverter.cs
- XmlDocument.cs
- FixedTextContainer.cs
- Configuration.cs
- BindingManagerDataErrorEventArgs.cs
- CapiNative.cs
- InsufficientMemoryException.cs
- WebControl.cs
- XmlBoundElement.cs
- DataGridViewColumnStateChangedEventArgs.cs
- StylusCollection.cs
- FlowchartDesignerCommands.cs
- TextClipboardData.cs
- Preprocessor.cs
- EntityDataSourceContextCreatedEventArgs.cs
- CodeDefaultValueExpression.cs
- WebDisplayNameAttribute.cs
- XmlTextAttribute.cs
- ReferenceConverter.cs
- DockPattern.cs
- UpdateRecord.cs
- DynamicDocumentPaginator.cs
- AnnotationHelper.cs
- GZipDecoder.cs
- HybridDictionary.cs
- XsltException.cs
- Rule.cs