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
- FileLogRecordHeader.cs
- WebServiceData.cs
- Image.cs
- AmbientLight.cs
- EncoderReplacementFallback.cs
- Model3D.cs
- BamlResourceContent.cs
- SystemGatewayIPAddressInformation.cs
- Highlights.cs
- ListItemConverter.cs
- CalendarDesigner.cs
- MetadataCache.cs
- MergeFilterQuery.cs
- HttpCacheVaryByContentEncodings.cs
- Constant.cs
- RequestCachingSection.cs
- SafePointer.cs
- MimeMapping.cs
- MenuItem.cs
- NamedPipeConnectionPoolSettings.cs
- VirtualizedItemPattern.cs
- Environment.cs
- COM2ColorConverter.cs
- TypeToken.cs
- XmlSchemaComplexContentRestriction.cs
- GlobalizationSection.cs
- TemplateBuilder.cs
- TextBox.cs
- WebPartManagerDesigner.cs
- Encoder.cs
- ListComponentEditor.cs
- TextInfo.cs
- RealProxy.cs
- ComAdminWrapper.cs
- DocumentCollection.cs
- ResourceAssociationSetEnd.cs
- _ProxyRegBlob.cs
- FormViewInsertedEventArgs.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- NamedPipeTransportElement.cs
- OdbcTransaction.cs
- webeventbuffer.cs
- NavigationProgressEventArgs.cs
- ListSourceHelper.cs
- AuthenticationService.cs
- ByteStreamGeometryContext.cs
- MessageQueueException.cs
- DbBuffer.cs
- RemoteWebConfigurationHostServer.cs
- SqlStream.cs
- RefreshPropertiesAttribute.cs
- CallbackWrapper.cs
- DatasetMethodGenerator.cs
- PeerNearMe.cs
- OdbcHandle.cs
- HttpCookiesSection.cs
- ToolStripSeparatorRenderEventArgs.cs
- SQLDateTimeStorage.cs
- FacetEnabledSchemaElement.cs
- PaperSource.cs
- ProcessHostMapPath.cs
- CompilerCollection.cs
- IBuiltInEvidence.cs
- SoapTypeAttribute.cs
- Automation.cs
- ClientCredentialsSecurityTokenManager.cs
- CssStyleCollection.cs
- FunctionOverloadResolver.cs
- LOSFormatter.cs
- ControlBuilder.cs
- WebSysDisplayNameAttribute.cs
- ListViewPagedDataSource.cs
- BasicExpandProvider.cs
- NavigateUrlConverter.cs
- IsolatedStorage.cs
- TrackingProfileManager.cs
- SortQuery.cs
- XmlCharCheckingReader.cs
- XmlProcessingInstruction.cs
- WindowPattern.cs
- ArgumentElement.cs
- WorkflowInspectionServices.cs
- _OverlappedAsyncResult.cs
- AsyncContentLoadedEventArgs.cs
- ScrollBarAutomationPeer.cs
- QuerySettings.cs
- DocumentOrderComparer.cs
- ColorAnimationUsingKeyFrames.cs
- TemplateControlParser.cs
- SmtpTransport.cs
- TextEditorSelection.cs
- ProxyFragment.cs
- SerializationBinder.cs
- Synchronization.cs
- unitconverter.cs
- JournalEntryStack.cs
- _ChunkParse.cs
- XmlWriterTraceListener.cs
- ScrollData.cs
- PngBitmapDecoder.cs