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
- SemaphoreFullException.cs
- AtomPub10CategoriesDocumentFormatter.cs
- WebPartDescription.cs
- SimpleApplicationHost.cs
- CompilationLock.cs
- WebControlsSection.cs
- Helper.cs
- Facet.cs
- FilteredXmlReader.cs
- BulletedListEventArgs.cs
- Substitution.cs
- JpegBitmapDecoder.cs
- XmlSchemaSequence.cs
- Types.cs
- LoginAutoFormat.cs
- BamlTreeNode.cs
- HandledMouseEvent.cs
- CustomDictionarySources.cs
- GridViewSelectEventArgs.cs
- BitmapEffectGroup.cs
- ITextView.cs
- SimpleNameService.cs
- TypeBuilderInstantiation.cs
- AppDomainAttributes.cs
- RootDesignerSerializerAttribute.cs
- PrePostDescendentsWalker.cs
- SessionPageStatePersister.cs
- MenuItem.cs
- Ops.cs
- TextLineResult.cs
- ProjectedWrapper.cs
- ContentElementCollection.cs
- RenderOptions.cs
- ThicknessAnimation.cs
- ContainerSelectorBehavior.cs
- Ticks.cs
- ListBindableAttribute.cs
- MultiView.cs
- CustomErrorsSection.cs
- FtpWebResponse.cs
- CompositionAdorner.cs
- BitmapCodecInfo.cs
- WebBrowserSiteBase.cs
- XmlSchemaObjectCollection.cs
- PackUriHelper.cs
- XmlLoader.cs
- WindowsEditBoxRange.cs
- ObjectDataSourceChooseMethodsPanel.cs
- TreeNodeStyleCollectionEditor.cs
- ScriptControl.cs
- HierarchicalDataSourceControl.cs
- PackagePart.cs
- RuntimeCompatibilityAttribute.cs
- DynamicFilterExpression.cs
- GeometryGroup.cs
- AuthenticationService.cs
- FormViewPagerRow.cs
- InputScopeNameConverter.cs
- MetadataWorkspace.cs
- StringFunctions.cs
- EventLogEntryCollection.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- WaitHandle.cs
- StrokeRenderer.cs
- LineGeometry.cs
- WmlValidationSummaryAdapter.cs
- StyleSelector.cs
- AssemblyBuilderData.cs
- GestureRecognitionResult.cs
- ButtonColumn.cs
- RegexNode.cs
- StylusPoint.cs
- EdmSchemaError.cs
- AssemblyBuilderData.cs
- AssemblyInfo.cs
- ChannelTerminatedException.cs
- XmlWrappingReader.cs
- ButtonFieldBase.cs
- UnsupportedPolicyOptionsException.cs
- ListSourceHelper.cs
- BuildProviderCollection.cs
- Component.cs
- SourceFilter.cs
- HtmlTableRowCollection.cs
- WorkflowExecutor.cs
- MemberHolder.cs
- ErrorEventArgs.cs
- _LocalDataStoreMgr.cs
- StylusPointProperty.cs
- DesignerSerializationVisibilityAttribute.cs
- DataRowComparer.cs
- RegexCapture.cs
- IsolatedStoragePermission.cs
- ComboBoxDesigner.cs
- XmlSerializationGeneratedCode.cs
- Freezable.cs
- RegexMatchCollection.cs
- MaterialGroup.cs
- CacheMemory.cs
- CombinedGeometry.cs