Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Cryptography / DSASignatureDeformatter.cs / 1305376 / DSASignatureDeformatter.cs
using System.Diagnostics.Contracts; // ==++== // // 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"); Contract.EndContractBlock(); _dsaKey = (DSA) key; } // // public methods // public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); Contract.EndContractBlock(); _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 (rgbHash == null) throw new ArgumentNullException("rgbHash"); if (rgbSignature == null) throw new ArgumentNullException("rgbSignature"); Contract.EndContractBlock(); if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); return _dsaKey.VerifySignature(rgbHash, rgbSignature); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. using System.Diagnostics.Contracts; // ==++== // // 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"); Contract.EndContractBlock(); _dsaKey = (DSA) key; } // // public methods // public override void SetKey(AsymmetricAlgorithm key) { if (key == null) throw new ArgumentNullException("key"); Contract.EndContractBlock(); _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 (rgbHash == null) throw new ArgumentNullException("rgbHash"); if (rgbSignature == null) throw new ArgumentNullException("rgbSignature"); Contract.EndContractBlock(); if (_dsaKey == null) throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey")); return _dsaKey.VerifySignature(rgbHash, rgbSignature); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PerformanceCounterManager.cs
- dbdatarecord.cs
- SystemInfo.cs
- CodeTypeDelegate.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- ConfigXmlDocument.cs
- SoapRpcMethodAttribute.cs
- ApplicationSecurityInfo.cs
- MenuItemStyleCollection.cs
- HttpModuleAction.cs
- ValueOfAction.cs
- ServiceHostingEnvironment.cs
- WebPartAuthorizationEventArgs.cs
- SettingsAttributeDictionary.cs
- EdmConstants.cs
- PictureBoxDesigner.cs
- Helpers.cs
- FrameworkRichTextComposition.cs
- WebPartUtil.cs
- EventMap.cs
- EventProperty.cs
- CollectionBase.cs
- ThreadPool.cs
- PackageProperties.cs
- SecurityDescriptor.cs
- TypedElement.cs
- ConnectionManagementElementCollection.cs
- Publisher.cs
- PngBitmapDecoder.cs
- LoginCancelEventArgs.cs
- CategoryAttribute.cs
- KnownTypes.cs
- ConfigurationPropertyAttribute.cs
- XmlArrayAttribute.cs
- GcHandle.cs
- TreeView.cs
- DbProviderServices.cs
- DesignSurfaceServiceContainer.cs
- XmlBaseReader.cs
- InstrumentationTracker.cs
- FileSystemWatcher.cs
- UrlEncodedParameterWriter.cs
- ExternalException.cs
- ContentControl.cs
- ToolboxComponentsCreatingEventArgs.cs
- DocumentPaginator.cs
- PropertyEmitterBase.cs
- XmlSchemaProviderAttribute.cs
- NameScope.cs
- CodeAccessSecurityEngine.cs
- KnownBoxes.cs
- Variable.cs
- CodeCastExpression.cs
- EntityDataSourceColumn.cs
- LayoutTableCell.cs
- EditorPartDesigner.cs
- DataServiceKeyAttribute.cs
- SqlAliaser.cs
- HttpCapabilitiesBase.cs
- ProfileGroupSettingsCollection.cs
- Slider.cs
- Compilation.cs
- OSEnvironmentHelper.cs
- JsonFormatWriterGenerator.cs
- AssemblyResourceLoader.cs
- WindowsSysHeader.cs
- DataGridViewCellStyle.cs
- ToolStripGripRenderEventArgs.cs
- Root.cs
- RegexNode.cs
- InkCanvasSelectionAdorner.cs
- PerspectiveCamera.cs
- HttpPostedFile.cs
- PrintPreviewGraphics.cs
- SchemaCollectionPreprocessor.cs
- ContextDataSourceContextData.cs
- SelectorAutomationPeer.cs
- CodeLabeledStatement.cs
- ThreadInterruptedException.cs
- _NegoStream.cs
- SpecialFolderEnumConverter.cs
- SystemSounds.cs
- LogWriteRestartAreaAsyncResult.cs
- DBAsyncResult.cs
- HtmlTableRow.cs
- Function.cs
- ErasingStroke.cs
- MultipleCopiesCollection.cs
- altserialization.cs
- HtmlTitle.cs
- PageContentAsyncResult.cs
- Container.cs
- AxHost.cs
- MissingMethodException.cs
- TcpTransportManager.cs
- securestring.cs
- OleDbPermission.cs
- SuppressIldasmAttribute.cs
- ExpressionList.cs
- Configuration.cs