Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / Security / Cryptography / DSASignatureFormatter.cs / 1 / DSASignatureFormatter.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//
// DSASignatureFormatter.cs
//
namespace System.Security.Cryptography {
[System.Runtime.InteropServices.ComVisible(true)]
public class DSASignatureFormatter : AsymmetricSignatureFormatter {
DSA _dsaKey;
String _oid;
//
// public constructors
//
public DSASignatureFormatter() {
// The hash algorithm is always SHA1
_oid = CryptoConfig.MapNameToOID("SHA1");
}
public DSASignatureFormatter(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 byte[] CreateSignature(byte[] rgbHash) {
if (_oid == null)
throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingOID"));
if (_dsaKey == null)
throw new CryptographicUnexpectedOperationException(Environment.GetResourceString("Cryptography_MissingKey"));
if (rgbHash == null)
throw new ArgumentNullException("rgbHash");
return _dsaKey.CreateSignature(rgbHash);
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TouchesOverProperty.cs
- InvokeProviderWrapper.cs
- WebBrowser.cs
- FrameSecurityDescriptor.cs
- InlinedAggregationOperator.cs
- RayMeshGeometry3DHitTestResult.cs
- PeerNameResolver.cs
- WebMessageEncodingElement.cs
- GroupBoxAutomationPeer.cs
- Input.cs
- RadioButton.cs
- ComponentTray.cs
- ClientRuntimeConfig.cs
- RsaSecurityKey.cs
- ConfigXmlComment.cs
- DelegatedStream.cs
- ProfilePropertyNameValidator.cs
- DataGridCellAutomationPeer.cs
- Path.cs
- DataGridViewMethods.cs
- ExpressionConverter.cs
- XmlIgnoreAttribute.cs
- XamlPointCollectionSerializer.cs
- ToolCreatedEventArgs.cs
- ThreadAttributes.cs
- ProxyDataContractResolver.cs
- SafeRightsManagementHandle.cs
- BinaryQueryOperator.cs
- RegexGroupCollection.cs
- ElapsedEventArgs.cs
- PasswordRecovery.cs
- DynamicDocumentPaginator.cs
- SchemaElement.cs
- X509SecurityToken.cs
- TableCellAutomationPeer.cs
- SafeNativeMethods.cs
- EnumValAlphaComparer.cs
- TextBreakpoint.cs
- LineServicesRun.cs
- ListViewInsertedEventArgs.cs
- RuleSettingsCollection.cs
- PersistenceMetadataNamespace.cs
- ToolStripGripRenderEventArgs.cs
- Ref.cs
- FillBehavior.cs
- PropertyChangingEventArgs.cs
- ListViewDeletedEventArgs.cs
- UnauthorizedAccessException.cs
- ADRoleFactoryConfiguration.cs
- DeclaredTypeValidator.cs
- ExpandableObjectConverter.cs
- SecurityBindingElement.cs
- SQLSingle.cs
- HttpsHostedTransportConfiguration.cs
- ResourceType.cs
- InvalidOleVariantTypeException.cs
- ListViewDesigner.cs
- ErrorStyle.cs
- RefExpr.cs
- ExpandCollapseProviderWrapper.cs
- MetadataFile.cs
- InternalPermissions.cs
- ImageBrush.cs
- FixedPosition.cs
- ModifierKeysConverter.cs
- GatewayDefinition.cs
- ContentHostHelper.cs
- QilPatternVisitor.cs
- DataViewListener.cs
- XslCompiledTransform.cs
- HtmlTernaryTree.cs
- DllNotFoundException.cs
- FontFamilyValueSerializer.cs
- FixedHyperLink.cs
- HtmlInputFile.cs
- LingerOption.cs
- CellTreeNodeVisitors.cs
- XamlSerializer.cs
- Propagator.Evaluator.cs
- ExceptionRoutedEventArgs.cs
- DetailsViewRow.cs
- SafeLibraryHandle.cs
- HandlerElement.cs
- AmbientValueAttribute.cs
- ListViewGroup.cs
- XPathArrayIterator.cs
- InternalConfigEventArgs.cs
- sqlstateclientmanager.cs
- HttpMethodAttribute.cs
- Point3DAnimationUsingKeyFrames.cs
- NullReferenceException.cs
- DataSourceCache.cs
- DocumentReference.cs
- Size3D.cs
- EUCJPEncoding.cs
- MDIWindowDialog.cs
- basevalidator.cs
- DateTimeParse.cs
- DataTablePropertyDescriptor.cs
- JavaScriptObjectDeserializer.cs