Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Security / Cryptography / SignatureDescription.cs / 1 / SignatureDescription.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//
// SignatureDescription.cs
//
namespace System.Security.Cryptography {
using System.Security.Util;
[System.Runtime.InteropServices.ComVisible(true)]
public class SignatureDescription {
private String _strKey;
private String _strDigest;
private String _strFormatter;
private String _strDeformatter;
//
// public constructors
//
public SignatureDescription() {
}
public SignatureDescription(SecurityElement el) {
if (el == null) throw new ArgumentNullException("el");
_strKey = el.SearchForTextOfTag("Key");
_strDigest = el.SearchForTextOfTag("Digest");
_strFormatter = el.SearchForTextOfTag("Formatter");
_strDeformatter = el.SearchForTextOfTag("Deformatter");
}
//
// property methods
//
public String KeyAlgorithm {
get { return _strKey; }
set { _strKey = value; }
}
public String DigestAlgorithm {
get { return _strDigest; }
set { _strDigest = value; }
}
public String FormatterAlgorithm {
get { return _strFormatter; }
set { _strFormatter = value; }
}
public String DeformatterAlgorithm {
get {return _strDeformatter; }
set {_strDeformatter = value; }
}
//
// public methods
//
public virtual AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) {
AsymmetricSignatureDeformatter item;
item = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName(_strDeformatter);
item.SetKey(key);
return item;
}
public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key) {
AsymmetricSignatureFormatter item;
item = (AsymmetricSignatureFormatter) CryptoConfig.CreateFromName(_strFormatter);
item.SetKey(key);
return item;
}
public virtual HashAlgorithm CreateDigest() {
return (HashAlgorithm) CryptoConfig.CreateFromName(_strDigest);
}
}
internal class RSAPKCS1SHA1SignatureDescription : SignatureDescription {
public RSAPKCS1SHA1SignatureDescription() {
KeyAlgorithm = "System.Security.Cryptography.RSACryptoServiceProvider";
DigestAlgorithm = "System.Security.Cryptography.SHA1CryptoServiceProvider";
FormatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureFormatter";
DeformatterAlgorithm = "System.Security.Cryptography.RSAPKCS1SignatureDeformatter";
}
public override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) {
AsymmetricSignatureDeformatter item = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName(DeformatterAlgorithm);
item.SetKey(key);
item.SetHashAlgorithm("SHA1");
return item;
}
}
internal class DSASignatureDescription : SignatureDescription {
public DSASignatureDescription() {
KeyAlgorithm = "System.Security.Cryptography.DSACryptoServiceProvider";
DigestAlgorithm = "System.Security.Cryptography.SHA1CryptoServiceProvider";
FormatterAlgorithm = "System.Security.Cryptography.DSASignatureFormatter";
DeformatterAlgorithm = "System.Security.Cryptography.DSASignatureDeformatter";
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RoutedPropertyChangedEventArgs.cs
- BitmapDecoder.cs
- ExpressionBuilderCollection.cs
- VisualTreeHelper.cs
- MultiBinding.cs
- RoutedEventValueSerializer.cs
- SqlCachedBuffer.cs
- CriticalHandle.cs
- __TransparentProxy.cs
- OpenTypeCommon.cs
- DispatcherBuilder.cs
- IntPtr.cs
- AnnotationResourceCollection.cs
- SettingsProperty.cs
- _ShellExpression.cs
- QilStrConcat.cs
- AffineTransform3D.cs
- XmlName.cs
- ProviderCommandInfoUtils.cs
- XhtmlBasicLabelAdapter.cs
- WindowsListView.cs
- DeviceContexts.cs
- InvokeDelegate.cs
- PerfCounterSection.cs
- Schema.cs
- ProfileProvider.cs
- DelegateArgumentValue.cs
- FixedDocumentSequencePaginator.cs
- UIElementIsland.cs
- SvcMapFileLoader.cs
- ApplicationHost.cs
- GeometryCombineModeValidation.cs
- DataSourceHelper.cs
- ComplexBindingPropertiesAttribute.cs
- ResourcePermissionBase.cs
- UpdateEventArgs.cs
- InternalResources.cs
- ProviderSettingsCollection.cs
- FixedSOMPage.cs
- DataMemberAttribute.cs
- WebResourceAttribute.cs
- PersonalizableAttribute.cs
- EnlistmentTraceIdentifier.cs
- TreeNodeBinding.cs
- DocumentApplicationJournalEntry.cs
- GlyphShapingProperties.cs
- GenericTextProperties.cs
- FontConverter.cs
- Restrictions.cs
- fixedPageContentExtractor.cs
- ThumbAutomationPeer.cs
- ResizeGrip.cs
- FaultCode.cs
- RequestCache.cs
- httpstaticobjectscollection.cs
- SecurityManager.cs
- BrowserTree.cs
- AxisAngleRotation3D.cs
- TreeViewItem.cs
- brushes.cs
- ScrollItemProviderWrapper.cs
- BrowsableAttribute.cs
- ObsoleteAttribute.cs
- XmlDataSourceDesigner.cs
- RetriableClipboard.cs
- TitleStyle.cs
- DateTimeConverter.cs
- storepermission.cs
- TimerElapsedEvenArgs.cs
- SocketAddress.cs
- MetadataFile.cs
- DbConnectionPoolIdentity.cs
- NegotiateStream.cs
- ResourcePool.cs
- TextFormatter.cs
- EditCommandColumn.cs
- panel.cs
- MSAAWinEventWrap.cs
- BitmapEffectRenderDataResource.cs
- MatrixConverter.cs
- ViewManager.cs
- NavigationProperty.cs
- Utils.cs
- DbConnectionPoolCounters.cs
- LinkUtilities.cs
- PopupControlService.cs
- Int64KeyFrameCollection.cs
- DoubleUtil.cs
- ImageButton.cs
- Attributes.cs
- FrameworkName.cs
- ClientSettings.cs
- StrongTypingException.cs
- ClientScriptManager.cs
- CellCreator.cs
- Error.cs
- DesignerRegion.cs
- EntityDescriptor.cs
- OracleTimeSpan.cs
- WindowsToolbarAsMenu.cs