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
- TextEditorDragDrop.cs
- ToolStripDesignerUtils.cs
- WinEventHandler.cs
- AccessDataSource.cs
- Container.cs
- SafeWaitHandle.cs
- WindowsListViewGroupHelper.cs
- DataTableReaderListener.cs
- DigestTraceRecordHelper.cs
- ActivityExecutionWorkItem.cs
- UrlMapping.cs
- XamlSerializerUtil.cs
- DesignerDataConnection.cs
- AutoSizeComboBox.cs
- ErrorHandler.cs
- AllMembershipCondition.cs
- DelegateSerializationHolder.cs
- GatewayIPAddressInformationCollection.cs
- CategoryAttribute.cs
- QueryAccessibilityHelpEvent.cs
- Int32AnimationUsingKeyFrames.cs
- Attributes.cs
- SmtpTransport.cs
- WsdlBuildProvider.cs
- TreeViewBindingsEditorForm.cs
- SrgsText.cs
- WorkerRequest.cs
- EncoderExceptionFallback.cs
- EnumValAlphaComparer.cs
- WsatServiceAddress.cs
- ZipIOExtraFieldZip64Element.cs
- DockAndAnchorLayout.cs
- LogPolicy.cs
- WorkflowInstanceExtensionManager.cs
- SamlAudienceRestrictionCondition.cs
- InfoCardPolicy.cs
- Config.cs
- ConfigXmlCDataSection.cs
- ReachSerializerAsync.cs
- Variant.cs
- PanelStyle.cs
- RawStylusInputCustomDataList.cs
- SqlClientFactory.cs
- UDPClient.cs
- MgmtConfigurationRecord.cs
- HttpResponseWrapper.cs
- RtfToXamlReader.cs
- RectValueSerializer.cs
- GeneralTransform.cs
- Attributes.cs
- TextEditorMouse.cs
- Point3DIndependentAnimationStorage.cs
- BlobPersonalizationState.cs
- XmlSchemaAnyAttribute.cs
- Operand.cs
- GC.cs
- WinInet.cs
- LinkArea.cs
- TwoPhaseCommitProxy.cs
- DataObject.cs
- LifetimeServices.cs
- XmlAttributeOverrides.cs
- NotifyParentPropertyAttribute.cs
- SecondaryIndexDefinition.cs
- CookieParameter.cs
- ParallelEnumerable.cs
- ItemCheckedEvent.cs
- WorkflowClientDeliverMessageWrapper.cs
- StringResourceManager.cs
- TextLine.cs
- WrapPanel.cs
- Encoder.cs
- InteropAutomationProvider.cs
- BuildResultCache.cs
- NamespaceList.cs
- SqlWriter.cs
- TransactedReceiveData.cs
- URI.cs
- DataList.cs
- TableChangeProcessor.cs
- GridErrorDlg.cs
- MessageAction.cs
- ToolCreatedEventArgs.cs
- precedingquery.cs
- SubMenuStyle.cs
- TemplatingOptionsDialog.cs
- ToolStripGrip.cs
- LabelAutomationPeer.cs
- ToolStripDropDownClosingEventArgs.cs
- GeneralTransform3DCollection.cs
- ListBase.cs
- FlatButtonAppearance.cs
- dsa.cs
- FragmentNavigationEventArgs.cs
- TextFindEngine.cs
- PictureBox.cs
- AddInServer.cs
- CompModSwitches.cs
- WrapPanel.cs
- NodeFunctions.cs