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
- Int64AnimationUsingKeyFrames.cs
- ImmutableCollection.cs
- Clipboard.cs
- MenuItemStyleCollection.cs
- StorageAssociationSetMapping.cs
- TextContainerHelper.cs
- BridgeDataReader.cs
- DataTemplateSelector.cs
- SystemIcmpV4Statistics.cs
- XmlReflectionMember.cs
- GuidTagList.cs
- SecurityTokenProvider.cs
- Vars.cs
- ObjectDataSourceSelectingEventArgs.cs
- SamlConstants.cs
- ProvidersHelper.cs
- CompositeControl.cs
- Exceptions.cs
- BitmapVisualManager.cs
- CredentialCache.cs
- RequestCache.cs
- StaticContext.cs
- FontNamesConverter.cs
- NativeMethods.cs
- Converter.cs
- SQLDecimalStorage.cs
- PerfService.cs
- HoistedLocals.cs
- BamlResourceSerializer.cs
- _emptywebproxy.cs
- XmlILCommand.cs
- CallbackDebugBehavior.cs
- SafeEventLogWriteHandle.cs
- ParserStack.cs
- ConfigurationValidatorAttribute.cs
- PostBackOptions.cs
- StateChangeEvent.cs
- SmtpTransport.cs
- XPathNavigator.cs
- PassportAuthenticationModule.cs
- FunctionUpdateCommand.cs
- loginstatus.cs
- ChineseLunisolarCalendar.cs
- XslNumber.cs
- PersianCalendar.cs
- BStrWrapper.cs
- ContentOnlyMessage.cs
- FixUpCollection.cs
- RemotingService.cs
- BinaryNode.cs
- EventMappingSettingsCollection.cs
- HtmlButton.cs
- BinaryMethodMessage.cs
- TableColumn.cs
- Query.cs
- SolidColorBrush.cs
- JournalNavigationScope.cs
- UnionQueryOperator.cs
- DesignerVerb.cs
- ValueOfAction.cs
- CodeSubDirectory.cs
- ScrollPatternIdentifiers.cs
- OrderByBuilder.cs
- Vector3DConverter.cs
- TreeViewItemAutomationPeer.cs
- Pair.cs
- XmlNodeList.cs
- ReturnValue.cs
- ScrollContentPresenter.cs
- ContainerVisual.cs
- SmiEventSink_Default.cs
- ReflectPropertyDescriptor.cs
- MatrixStack.cs
- AssociationSetMetadata.cs
- SqlConnectionFactory.cs
- WebPartAddingEventArgs.cs
- DataGridCellInfo.cs
- UpnEndpointIdentityExtension.cs
- GeometryHitTestParameters.cs
- SystemIPGlobalStatistics.cs
- UTF32Encoding.cs
- BaseCollection.cs
- ChannelTracker.cs
- AutomationPeer.cs
- SqlNodeAnnotations.cs
- Cursor.cs
- SpeechUI.cs
- MsmqIntegrationBindingElement.cs
- BinaryObjectWriter.cs
- KeyEvent.cs
- WindowsTreeView.cs
- StringFormat.cs
- UIHelper.cs
- ComboBoxRenderer.cs
- IISUnsafeMethods.cs
- InputScopeManager.cs
- SingleConverter.cs
- FunctionImportMapping.cs
- ObfuscationAttribute.cs
- FlowDocumentView.cs