using System;
using System.Runtime.InteropServices;
namespace System.Security.Cryptography
{
/// Verifies a Digital Signature Algorithm () PKCS#1 v1.5 signature.
// Token: 0x020004FC RID: 1276
[ComVisible(true)]
public class DSASignatureDeformatter : AsymmetricSignatureDeformatter
{
/// Initializes a new instance of the class.
// Token: 0x06002F31 RID: 12081 RVA: 0x0009808C File Offset: 0x0009628C
public DSASignatureDeformatter()
{
}
/// Initializes a new instance of the class with the specified key.
/// The instance of Digital Signature Algorithm () that holds the key.
///
/// is null.
// Token: 0x06002F32 RID: 12082 RVA: 0x00098094 File Offset: 0x00096294
public DSASignatureDeformatter(AsymmetricAlgorithm key)
{
this.SetKey(key);
}
/// Specifies the hash algorithm for the Digital Signature Algorithm () signature deformatter.
/// The name of the hash algorithm to use for the signature deformatter.
/// The parameter does not map to the hash algorithm.
// Token: 0x06002F33 RID: 12083 RVA: 0x000980A4 File Offset: 0x000962A4
public override void SetHashAlgorithm(string strName)
{
if (strName == null)
{
throw new ArgumentNullException("strName");
}
try
{
SHA1.Create(strName);
}
catch (InvalidCastException)
{
throw new CryptographicUnexpectedOperationException(Locale.GetText("DSA requires SHA1"));
}
}
/// Specifies the key to be used for the Digital Signature Algorithm () signature deformatter.
/// The instance of that holds the key.
///
/// is null.
// Token: 0x06002F34 RID: 12084 RVA: 0x00098100 File Offset: 0x00096300
public override void SetKey(AsymmetricAlgorithm key)
{
if (key != null)
{
this.dsa = (DSA)key;
return;
}
throw new ArgumentNullException("key");
}
/// Verifies the Digital Signature Algorithm () signature on the data.
/// true if the signature is valid for the data; otherwise, false.
/// The data signed with .
/// The signature to be verified for .
///
/// is null.-or- is null.
/// The DSA key is missing.
// Token: 0x06002F35 RID: 12085 RVA: 0x00098130 File Offset: 0x00096330
public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
{
if (this.dsa == null)
{
throw new CryptographicUnexpectedOperationException(Locale.GetText("missing key"));
}
return this.dsa.VerifySignature(rgbHash, rgbSignature);
}
// Token: 0x04001346 RID: 4934
private DSA dsa;
}
}