Code:
/ DotNET / DotNET / 8.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
- DSACryptoServiceProvider.cs
- ContextMenuAutomationPeer.cs
- AncillaryOps.cs
- ComplexLine.cs
- ReadOnlyDictionary.cs
- TemplateApplicationHelper.cs
- SoapElementAttribute.cs
- PeerResolverBindingElement.cs
- ScaleTransform3D.cs
- RtfToXamlLexer.cs
- QueryResultOp.cs
- DataGridViewColumnCollection.cs
- KeyPressEvent.cs
- SevenBitStream.cs
- IpcPort.cs
- basemetadatamappingvisitor.cs
- WindowsFormsSynchronizationContext.cs
- CLSCompliantAttribute.cs
- HwndSource.cs
- ToolStripItemRenderEventArgs.cs
- XMLDiffLoader.cs
- RawStylusInputReport.cs
- tooltip.cs
- OracleParameterBinding.cs
- HMACMD5.cs
- RightsManagementManager.cs
- DataList.cs
- FilterableAttribute.cs
- ISAPIRuntime.cs
- Opcode.cs
- ScrollPatternIdentifiers.cs
- ClientBuildManager.cs
- CopyAttributesAction.cs
- XPathMessageFilterElement.cs
- ProgressBarHighlightConverter.cs
- SystemDiagnosticsSection.cs
- SqlConnectionPoolProviderInfo.cs
- DelegateArgumentValue.cs
- LinearQuaternionKeyFrame.cs
- ProcessInfo.cs
- DefaultValidator.cs
- _IPv6Address.cs
- SafePEFileHandle.cs
- ObjectDataSourceView.cs
- FieldBuilder.cs
- PipelineComponent.cs
- PolicyStatement.cs
- RestHandler.cs
- HtmlListAdapter.cs
- CacheMemory.cs
- TableLayout.cs
- ChannelTerminatedException.cs
- UIInitializationException.cs
- CookielessHelper.cs
- HashMembershipCondition.cs
- HttpListenerResponse.cs
- NameValuePair.cs
- BindingMemberInfo.cs
- DictionaryContent.cs
- DatagridviewDisplayedBandsData.cs
- WindowsGrip.cs
- MouseCaptureWithinProperty.cs
- RegisterResponseInfo.cs
- UIElementHelper.cs
- ArraySortHelper.cs
- StorageScalarPropertyMapping.cs
- HttpCapabilitiesEvaluator.cs
- SeverityFilter.cs
- BuildResultCache.cs
- OptimalBreakSession.cs
- DataTrigger.cs
- PropertyFilterAttribute.cs
- TableAdapterManagerGenerator.cs
- CodeSnippetStatement.cs
- Evidence.cs
- LocalizableResourceBuilder.cs
- MailBnfHelper.cs
- OdbcDataReader.cs
- DataTableMappingCollection.cs
- XmlQueryContext.cs
- CmsInterop.cs
- XmlSchemaImport.cs
- SqlSelectStatement.cs
- RectangleGeometry.cs
- XmlCharCheckingReader.cs
- FixedDocumentPaginator.cs
- JsonServiceDocumentSerializer.cs
- XhtmlMobileTextWriter.cs
- TypeExtensions.cs
- ExternalCalls.cs
- XmlNode.cs
- TrackingMemoryStreamFactory.cs
- ChangeTracker.cs
- ServiceControllerDesigner.cs
- ProfileGroupSettings.cs
- MorphHelper.cs
- SQLMoney.cs
- WorkflowServiceBehavior.cs
- DbReferenceCollection.cs
- ObjectPropertyMapping.cs