45 lines
2.4 KiB
C#
45 lines
2.4 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace System.Security.Cryptography
|
|
{
|
|
/// <summary>Represents the abstract base class from which all implementations of asymmetric signature deformatters derive.</summary>
|
|
// Token: 0x020004E8 RID: 1256
|
|
[ComVisible(true)]
|
|
public abstract class AsymmetricSignatureDeformatter
|
|
{
|
|
/// <summary>When overridden in a derived class, sets the hash algorithm to use for verifying the signature.</summary>
|
|
/// <param name="strName">The name of the hash algorithm to use for verifying the signature. </param>
|
|
// Token: 0x06002E94 RID: 11924
|
|
public abstract void SetHashAlgorithm(string strName);
|
|
|
|
/// <summary>When overridden in a derived class, sets the public key to use for verifying the signature.</summary>
|
|
/// <param name="key">The instance of an implementation of <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> that holds the public key. </param>
|
|
// Token: 0x06002E95 RID: 11925
|
|
public abstract void SetKey(AsymmetricAlgorithm key);
|
|
|
|
/// <summary>When overridden in a derived class, verifies the signature for the specified data.</summary>
|
|
/// <returns>true if <paramref name="rgbSignature" /> matches the signature computed using the specified hash algorithm and key on <paramref name="rgbHash" />; otherwise, false.</returns>
|
|
/// <param name="rgbHash">The data signed with <paramref name="rgbSignature" />. </param>
|
|
/// <param name="rgbSignature">The signature to be verified for <paramref name="rgbHash" />. </param>
|
|
// Token: 0x06002E96 RID: 11926
|
|
public abstract bool VerifySignature(byte[] rgbHash, byte[] rgbSignature);
|
|
|
|
/// <summary>Verifies the signature from the specified hash value.</summary>
|
|
/// <returns>true if the signature is valid for the hash; otherwise, false.</returns>
|
|
/// <param name="hash">The hash algorithm to use to verify the signature. </param>
|
|
/// <param name="rgbSignature">The signature to be verified. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">The <paramref name="hash" /> parameter is null. </exception>
|
|
// Token: 0x06002E97 RID: 11927 RVA: 0x000951B4 File Offset: 0x000933B4
|
|
public virtual bool VerifySignature(HashAlgorithm hash, byte[] rgbSignature)
|
|
{
|
|
if (hash == null)
|
|
{
|
|
throw new ArgumentNullException("hash");
|
|
}
|
|
this.SetHashAlgorithm(hash.ToString());
|
|
return this.VerifySignature(hash.Hash, rgbSignature);
|
|
}
|
|
}
|
|
}
|