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
- EdmScalarPropertyAttribute.cs
- SafeNativeMethods.cs
- XmlDataDocument.cs
- MetadataException.cs
- ProfileParameter.cs
- TextEncodedRawTextWriter.cs
- NotSupportedException.cs
- TimeSpanSecondsConverter.cs
- BevelBitmapEffect.cs
- EventBuilder.cs
- UITypeEditor.cs
- CanonicalizationDriver.cs
- DeviceSpecificDesigner.cs
- SqlConnectionManager.cs
- DataControlCommands.cs
- Task.cs
- ReadonlyMessageFilter.cs
- Thread.cs
- TagPrefixAttribute.cs
- StyleSheetRefUrlEditor.cs
- VirtualPath.cs
- TraceListeners.cs
- ObjectViewQueryResultData.cs
- SafeHandles.cs
- DataGridItemCollection.cs
- SettingsPropertyNotFoundException.cs
- ValueProviderWrapper.cs
- SafePEFileHandle.cs
- Int16AnimationBase.cs
- PerformanceCounter.cs
- QilGenerator.cs
- AppDomainProtocolHandler.cs
- SchemaImporterExtensionElement.cs
- DynamicField.cs
- WebEvents.cs
- SubMenuStyle.cs
- BitArray.cs
- WebHttpDispatchOperationSelector.cs
- HorizontalAlignConverter.cs
- SystemColors.cs
- ErrorRuntimeConfig.cs
- MimeTypeAttribute.cs
- CultureMapper.cs
- RequestNavigateEventArgs.cs
- CodeCompileUnit.cs
- HtmlInputImage.cs
- WindowsPrincipal.cs
- ItemType.cs
- ImageButton.cs
- ContextMenuService.cs
- ToolStripContainer.cs
- InputScopeConverter.cs
- BamlBinaryReader.cs
- ColorPalette.cs
- XXXInfos.cs
- ProviderConnectionPointCollection.cs
- BitmapCodecInfoInternal.cs
- SmtpDigestAuthenticationModule.cs
- RTLAwareMessageBox.cs
- DocumentApplicationDocumentViewer.cs
- WarningException.cs
- TreeView.cs
- StatusCommandUI.cs
- HitTestParameters.cs
- IndentTextWriter.cs
- DataSetMappper.cs
- PropertyNames.cs
- DataGridViewComboBoxColumnDesigner.cs
- PagesSection.cs
- XmlHierarchyData.cs
- ProfileGroupSettings.cs
- BinarySecretSecurityToken.cs
- RijndaelManagedTransform.cs
- GridViewRowPresenterBase.cs
- ComplexTypeEmitter.cs
- DropShadowBitmapEffect.cs
- XmlSchemaCollection.cs
- SByteStorage.cs
- AnimatedTypeHelpers.cs
- StringFormat.cs
- DbParameterCollectionHelper.cs
- KeyboardEventArgs.cs
- ListViewItem.cs
- ManipulationInertiaStartingEventArgs.cs
- ResourceDefaultValueAttribute.cs
- ComboBoxDesigner.cs
- BrowserCapabilitiesCodeGenerator.cs
- DataChangedEventManager.cs
- WindowsScrollBarBits.cs
- StylusDownEventArgs.cs
- WebRequestModulesSection.cs
- SourceFileBuildProvider.cs
- DocumentOrderQuery.cs
- ProvidePropertyAttribute.cs
- DataGridViewAutoSizeModeEventArgs.cs
- EntityModelSchemaGenerator.cs
- ApplicationManager.cs
- _ChunkParse.cs
- ViewBase.cs
- ADMembershipProvider.cs