Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Cryptography / SignatureDescription.cs / 1305376 / SignatureDescription.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// [....]
//
//
// SignatureDescription.cs
//
namespace System.Security.Cryptography {
using System.Security.Util;
using System.Diagnostics.Contracts;
[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");
Contract.EndContractBlock();
_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
//
[System.Security.SecuritySafeCritical] // auto-generated
public virtual AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) {
AsymmetricSignatureDeformatter item;
item = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName(_strDeformatter);
item.SetKey(key);
return item;
}
[System.Security.SecuritySafeCritical] // auto-generated
public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key) {
AsymmetricSignatureFormatter item;
item = (AsymmetricSignatureFormatter) CryptoConfig.CreateFromName(_strFormatter);
item.SetKey(key);
return item;
}
[System.Security.SecuritySafeCritical] // auto-generated
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.
//
// ==--==
// [....]
//
//
// SignatureDescription.cs
//
namespace System.Security.Cryptography {
using System.Security.Util;
using System.Diagnostics.Contracts;
[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");
Contract.EndContractBlock();
_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
//
[System.Security.SecuritySafeCritical] // auto-generated
public virtual AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key) {
AsymmetricSignatureDeformatter item;
item = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName(_strDeformatter);
item.SetKey(key);
return item;
}
[System.Security.SecuritySafeCritical] // auto-generated
public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key) {
AsymmetricSignatureFormatter item;
item = (AsymmetricSignatureFormatter) CryptoConfig.CreateFromName(_strFormatter);
item.SetKey(key);
return item;
}
[System.Security.SecuritySafeCritical] // auto-generated
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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CommandConverter.cs
- CommonDialog.cs
- SHA1CryptoServiceProvider.cs
- ScaleTransform.cs
- PathFigureCollectionConverter.cs
- ProtocolInformationReader.cs
- SamlAuthenticationStatement.cs
- FrameworkElementFactoryMarkupObject.cs
- RuntimeEnvironment.cs
- ApplicationDirectory.cs
- StatusBarItem.cs
- DateTimeUtil.cs
- BlockingCollection.cs
- __Error.cs
- PrintPreviewGraphics.cs
- ExtensionQuery.cs
- AuthenticationServiceManager.cs
- InteropBitmapSource.cs
- EnumerableRowCollectionExtensions.cs
- MD5HashHelper.cs
- TraceContextEventArgs.cs
- BindingContext.cs
- GridSplitterAutomationPeer.cs
- TransformDescriptor.cs
- ReferenceEqualityComparer.cs
- XmlElementAttributes.cs
- WrapPanel.cs
- Viewport3DAutomationPeer.cs
- DateTimeOffset.cs
- EventLogTraceListener.cs
- DataGridToolTip.cs
- DataGridViewCellMouseEventArgs.cs
- NativeMethods.cs
- PTProvider.cs
- PageHandlerFactory.cs
- DoubleAnimationClockResource.cs
- UniformGrid.cs
- ObjectRef.cs
- OdbcTransaction.cs
- UITypeEditor.cs
- ConfigXmlWhitespace.cs
- EpmContentDeSerializerBase.cs
- CatalogZone.cs
- ClockController.cs
- VisualStyleTypesAndProperties.cs
- DbConnectionStringBuilder.cs
- SequenceDesigner.cs
- ConcurrentDictionary.cs
- FilteredReadOnlyMetadataCollection.cs
- RestHandler.cs
- XamlVector3DCollectionSerializer.cs
- PrintController.cs
- RunInstallerAttribute.cs
- TableDesigner.cs
- Size3D.cs
- MorphHelpers.cs
- FreeFormDragDropManager.cs
- DeclarativeConditionsCollection.cs
- ForeignKeyConstraint.cs
- Label.cs
- AnnotationStore.cs
- NamedPipeAppDomainProtocolHandler.cs
- Label.cs
- SchemaImporterExtensionsSection.cs
- RegexInterpreter.cs
- RefreshEventArgs.cs
- AsyncResult.cs
- PlaceHolder.cs
- Composition.cs
- TypeSchema.cs
- SafeBuffer.cs
- StreamWithDictionary.cs
- ConfigXmlElement.cs
- ArgumentElement.cs
- XmlAutoDetectWriter.cs
- ThreadStartException.cs
- GlobalEventManager.cs
- ReliableDuplexSessionChannel.cs
- XmlProcessingInstruction.cs
- XmlReflectionMember.cs
- WindowsTooltip.cs
- DefaultValueAttribute.cs
- QuaternionConverter.cs
- HtmlInputButton.cs
- panel.cs
- DataServiceExpressionVisitor.cs
- GcHandle.cs
- FormViewInsertedEventArgs.cs
- SQLMembershipProvider.cs
- NopReturnReader.cs
- BindingNavigator.cs
- MetabaseServerConfig.cs
- RelatedCurrencyManager.cs
- _Rfc2616CacheValidators.cs
- RangeValueProviderWrapper.cs
- TransformCryptoHandle.cs
- Visual3DCollection.cs
- MexBindingBindingCollectionElement.cs
- RuntimeEnvironment.cs
- FlowDocumentPageViewerAutomationPeer.cs