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
- RoleService.cs
- _ShellExpression.cs
- FloaterBaseParaClient.cs
- AssemblyResourceLoader.cs
- TimestampInformation.cs
- HashHelper.cs
- RoutedEvent.cs
- StaticTextPointer.cs
- TextDecorations.cs
- PeerNameRecord.cs
- ResXResourceReader.cs
- TableCell.cs
- DataSourceControl.cs
- ComponentEditorPage.cs
- RTLAwareMessageBox.cs
- SettingsContext.cs
- XmlDownloadManager.cs
- NonParentingControl.cs
- MetadataCache.cs
- RequiredAttributeAttribute.cs
- FixedDocumentPaginator.cs
- PathStreamGeometryContext.cs
- GregorianCalendarHelper.cs
- SqlNodeAnnotation.cs
- PerformanceCounterCategory.cs
- InkPresenter.cs
- KeyGesture.cs
- ResourceExpressionEditorSheet.cs
- RadialGradientBrush.cs
- NotificationContext.cs
- CommunicationException.cs
- DiscoveryVersion.cs
- SnapLine.cs
- GroupStyle.cs
- ScriptBehaviorDescriptor.cs
- bidPrivateBase.cs
- BindingEntityInfo.cs
- Base64Stream.cs
- XmlNodeChangedEventManager.cs
- TransformerTypeCollection.cs
- Site.cs
- SimplePropertyEntry.cs
- SourceItem.cs
- RangeContentEnumerator.cs
- PaperSource.cs
- WindowsRichEdit.cs
- DataSourceHelper.cs
- CultureMapper.cs
- Track.cs
- UnsafeNativeMethods.cs
- X509UI.cs
- DbDataRecord.cs
- VisualTransition.cs
- StaticDataManager.cs
- PointAnimationClockResource.cs
- SqlErrorCollection.cs
- DBSchemaTable.cs
- DateTimePicker.cs
- Matrix3DStack.cs
- DesignerSerializationOptionsAttribute.cs
- HttpProtocolReflector.cs
- GPRECTF.cs
- CrossSiteScriptingValidation.cs
- DataTableNewRowEvent.cs
- CatalogPart.cs
- RelationalExpressions.cs
- DataViewSettingCollection.cs
- ContentType.cs
- WebColorConverter.cs
- securitymgrsite.cs
- ServiceCredentialsElement.cs
- ComMethodElement.cs
- FacetDescriptionElement.cs
- ObjectManager.cs
- TabControlAutomationPeer.cs
- UIElementCollection.cs
- LinqDataView.cs
- StrokeDescriptor.cs
- HashMembershipCondition.cs
- TcpAppDomainProtocolHandler.cs
- EmptyReadOnlyDictionaryInternal.cs
- OptimizerPatterns.cs
- XamlReaderHelper.cs
- EncoderExceptionFallback.cs
- DataServices.cs
- InputScopeManager.cs
- ServiceChannel.cs
- WindowsScroll.cs
- ControlParameter.cs
- DataGridViewCellLinkedList.cs
- EditorPartCollection.cs
- DbCommandDefinition.cs
- XComponentModel.cs
- SiteMapNodeItem.cs
- UIInitializationException.cs
- RenderingBiasValidation.cs
- GroupItem.cs
- OleDbCommandBuilder.cs
- RoleService.cs
- SoapSchemaMember.cs