171 lines
7.1 KiB
C#
171 lines
7.1 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace System.Security.Cryptography
|
|
{
|
|
/// <summary>Contains information about the properties of a digital signature.</summary>
|
|
// Token: 0x02000535 RID: 1333
|
|
[ComVisible(true)]
|
|
public class SignatureDescription
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.SignatureDescription" /> class.</summary>
|
|
// Token: 0x060030CE RID: 12494 RVA: 0x000A7E54 File Offset: 0x000A6054
|
|
public SignatureDescription()
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.SignatureDescription" /> class from the specified <see cref="T:System.Security.SecurityElement" />.</summary>
|
|
/// <param name="el">The <see cref="T:System.Security.SecurityElement" /> from which to get the algorithms for the signature description. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">The <paramref name="el" /> parameter is null.</exception>
|
|
// Token: 0x060030CF RID: 12495 RVA: 0x000A7E5C File Offset: 0x000A605C
|
|
public SignatureDescription(SecurityElement el)
|
|
{
|
|
if (el == null)
|
|
{
|
|
throw new ArgumentNullException("el");
|
|
}
|
|
SecurityElement securityElement = el.SearchForChildByTag("Deformatter");
|
|
this._DeformatterAlgorithm = ((securityElement != null) ? securityElement.Text : null);
|
|
securityElement = el.SearchForChildByTag("Digest");
|
|
this._DigestAlgorithm = ((securityElement != null) ? securityElement.Text : null);
|
|
securityElement = el.SearchForChildByTag("Formatter");
|
|
this._FormatterAlgorithm = ((securityElement != null) ? securityElement.Text : null);
|
|
securityElement = el.SearchForChildByTag("Key");
|
|
this._KeyAlgorithm = ((securityElement != null) ? securityElement.Text : null);
|
|
}
|
|
|
|
/// <summary>Gets or sets the deformatter algorithm for the signature description.</summary>
|
|
/// <returns>The deformatter algorithm for the signature description.</returns>
|
|
// Token: 0x1700098B RID: 2443
|
|
// (get) Token: 0x060030D0 RID: 12496 RVA: 0x000A7F10 File Offset: 0x000A6110
|
|
// (set) Token: 0x060030D1 RID: 12497 RVA: 0x000A7F18 File Offset: 0x000A6118
|
|
public string DeformatterAlgorithm
|
|
{
|
|
get
|
|
{
|
|
return this._DeformatterAlgorithm;
|
|
}
|
|
set
|
|
{
|
|
this._DeformatterAlgorithm = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the digest algorithm for the signature description.</summary>
|
|
/// <returns>The digest algorithm for the signature description.</returns>
|
|
// Token: 0x1700098C RID: 2444
|
|
// (get) Token: 0x060030D2 RID: 12498 RVA: 0x000A7F24 File Offset: 0x000A6124
|
|
// (set) Token: 0x060030D3 RID: 12499 RVA: 0x000A7F2C File Offset: 0x000A612C
|
|
public string DigestAlgorithm
|
|
{
|
|
get
|
|
{
|
|
return this._DigestAlgorithm;
|
|
}
|
|
set
|
|
{
|
|
this._DigestAlgorithm = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the formatter algorithm for the signature description.</summary>
|
|
/// <returns>The formatter algorithm for the signature description.</returns>
|
|
// Token: 0x1700098D RID: 2445
|
|
// (get) Token: 0x060030D4 RID: 12500 RVA: 0x000A7F38 File Offset: 0x000A6138
|
|
// (set) Token: 0x060030D5 RID: 12501 RVA: 0x000A7F40 File Offset: 0x000A6140
|
|
public string FormatterAlgorithm
|
|
{
|
|
get
|
|
{
|
|
return this._FormatterAlgorithm;
|
|
}
|
|
set
|
|
{
|
|
this._FormatterAlgorithm = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the key algorithm for the signature description.</summary>
|
|
/// <returns>The key algorithm for the signature description.</returns>
|
|
// Token: 0x1700098E RID: 2446
|
|
// (get) Token: 0x060030D6 RID: 12502 RVA: 0x000A7F4C File Offset: 0x000A614C
|
|
// (set) Token: 0x060030D7 RID: 12503 RVA: 0x000A7F54 File Offset: 0x000A6154
|
|
public string KeyAlgorithm
|
|
{
|
|
get
|
|
{
|
|
return this._KeyAlgorithm;
|
|
}
|
|
set
|
|
{
|
|
this._KeyAlgorithm = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Creates an <see cref="T:System.Security.Cryptography.AsymmetricSignatureDeformatter" /> instance with the specified key using the <see cref="P:System.Security.Cryptography.SignatureDescription.DeformatterAlgorithm" /> property.</summary>
|
|
/// <returns>The newly created <see cref="T:System.Security.Cryptography.AsymmetricSignatureDeformatter" /> instance.</returns>
|
|
/// <param name="key">The key to use in the <see cref="T:System.Security.Cryptography.AsymmetricSignatureDeformatter" />. </param>
|
|
// Token: 0x060030D8 RID: 12504 RVA: 0x000A7F60 File Offset: 0x000A6160
|
|
public virtual AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key)
|
|
{
|
|
if (this._DeformatterAlgorithm == null)
|
|
{
|
|
throw new ArgumentNullException("DeformatterAlgorithm");
|
|
}
|
|
AsymmetricSignatureDeformatter asymmetricSignatureDeformatter = (AsymmetricSignatureDeformatter)CryptoConfig.CreateFromName(this._DeformatterAlgorithm);
|
|
if (this._KeyAlgorithm == null)
|
|
{
|
|
throw new NullReferenceException("KeyAlgorithm");
|
|
}
|
|
asymmetricSignatureDeformatter.SetKey(key);
|
|
return asymmetricSignatureDeformatter;
|
|
}
|
|
|
|
/// <summary>Creates a <see cref="T:System.Security.Cryptography.HashAlgorithm" /> instance using the <see cref="P:System.Security.Cryptography.SignatureDescription.DigestAlgorithm" /> property.</summary>
|
|
/// <returns>The newly created <see cref="T:System.Security.Cryptography.HashAlgorithm" /> instance.</returns>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
|
/// </PermissionSet>
|
|
// Token: 0x060030D9 RID: 12505 RVA: 0x000A7FB4 File Offset: 0x000A61B4
|
|
public virtual HashAlgorithm CreateDigest()
|
|
{
|
|
if (this._DigestAlgorithm == null)
|
|
{
|
|
throw new ArgumentNullException("DigestAlgorithm");
|
|
}
|
|
return (HashAlgorithm)CryptoConfig.CreateFromName(this._DigestAlgorithm);
|
|
}
|
|
|
|
/// <summary>Creates an <see cref="T:System.Security.Cryptography.AsymmetricSignatureFormatter" /> instance with the specified key using the <see cref="P:System.Security.Cryptography.SignatureDescription.FormatterAlgorithm" /> property.</summary>
|
|
/// <returns>The newly created <see cref="T:System.Security.Cryptography.AsymmetricSignatureFormatter" /> instance.</returns>
|
|
/// <param name="key">The key to use in the <see cref="T:System.Security.Cryptography.AsymmetricSignatureFormatter" />. </param>
|
|
// Token: 0x060030DA RID: 12506 RVA: 0x000A7FE8 File Offset: 0x000A61E8
|
|
public virtual AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key)
|
|
{
|
|
if (this._FormatterAlgorithm == null)
|
|
{
|
|
throw new ArgumentNullException("FormatterAlgorithm");
|
|
}
|
|
AsymmetricSignatureFormatter asymmetricSignatureFormatter = (AsymmetricSignatureFormatter)CryptoConfig.CreateFromName(this._FormatterAlgorithm);
|
|
if (this._KeyAlgorithm == null)
|
|
{
|
|
throw new NullReferenceException("KeyAlgorithm");
|
|
}
|
|
asymmetricSignatureFormatter.SetKey(key);
|
|
return asymmetricSignatureFormatter;
|
|
}
|
|
|
|
// Token: 0x040013F5 RID: 5109
|
|
private string _DeformatterAlgorithm;
|
|
|
|
// Token: 0x040013F6 RID: 5110
|
|
private string _DigestAlgorithm;
|
|
|
|
// Token: 0x040013F7 RID: 5111
|
|
private string _FormatterAlgorithm;
|
|
|
|
// Token: 0x040013F8 RID: 5112
|
|
private string _KeyAlgorithm;
|
|
}
|
|
}
|