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
- DefaultAssemblyResolver.cs
- TdsValueSetter.cs
- FormsIdentity.cs
- GeometryDrawing.cs
- GroupStyle.cs
- SerializerWriterEventHandlers.cs
- SetStateEventArgs.cs
- DetailsViewPagerRow.cs
- DataControlFieldCollection.cs
- DataColumnMappingCollection.cs
- HttpProfileGroupBase.cs
- Comparer.cs
- BinaryCommonClasses.cs
- DataGridPagerStyle.cs
- DataGridHeaderBorder.cs
- BindValidationContext.cs
- AssemblyInfo.cs
- RegexWorker.cs
- DescendentsWalkerBase.cs
- FixedElement.cs
- ObjectViewQueryResultData.cs
- MenuBase.cs
- MenuItemStyle.cs
- PassportIdentity.cs
- DbConnectionClosed.cs
- MemberInfoSerializationHolder.cs
- QueryModel.cs
- MetadataCacheItem.cs
- StorageEndPropertyMapping.cs
- WmfPlaceableFileHeader.cs
- FilterElement.cs
- ParagraphResult.cs
- TextFormatterHost.cs
- XMLSyntaxException.cs
- Size3DConverter.cs
- FunctionMappingTranslator.cs
- RuntimeCompatibilityAttribute.cs
- NotifyIcon.cs
- DetailsView.cs
- TypeExtension.cs
- FontWeights.cs
- InputQueueChannelAcceptor.cs
- ContentPropertyAttribute.cs
- SvcMapFileSerializer.cs
- DecoratedNameAttribute.cs
- XmlAnyElementAttribute.cs
- MarshalByValueComponent.cs
- OpenTypeCommon.cs
- XmlCharCheckingWriter.cs
- X509Utils.cs
- PartBasedPackageProperties.cs
- BitmapEffectInput.cs
- Size3D.cs
- FixedSOMElement.cs
- ComAwareEventInfo.cs
- EmbossBitmapEffect.cs
- _TransmitFileOverlappedAsyncResult.cs
- WebSysDefaultValueAttribute.cs
- OdbcParameter.cs
- DesignerLoader.cs
- PackageStore.cs
- PackagePartCollection.cs
- CmsInterop.cs
- SqlPersonalizationProvider.cs
- SspiSafeHandles.cs
- WebPartsSection.cs
- ObjectSecurity.cs
- CqlQuery.cs
- AnimationTimeline.cs
- PermissionRequestEvidence.cs
- MailAddressParser.cs
- DataGridTablesFactory.cs
- GridViewColumn.cs
- TextElementAutomationPeer.cs
- ProfileService.cs
- FormViewInsertedEventArgs.cs
- AbandonedMutexException.cs
- SqlRetyper.cs
- MaskedTextBox.cs
- RenderingEventArgs.cs
- DataGrid.cs
- GiveFeedbackEvent.cs
- SiteMapProvider.cs
- Delay.cs
- SkewTransform.cs
- ChangeDirector.cs
- KeyValuePairs.cs
- GacUtil.cs
- Help.cs
- TitleStyle.cs
- PathParser.cs
- GcSettings.cs
- PartialArray.cs
- SiteMapNodeItemEventArgs.cs
- CommandManager.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- DataListItemEventArgs.cs
- Signature.cs
- XmlDocumentSerializer.cs
- SymmetricAlgorithm.cs