using System;
using System.Runtime.InteropServices;
namespace System.Security.Cryptography
{
/// Creates a Digital Signature Algorithm () signature.
// Token: 0x020004FD RID: 1277
[ComVisible(true)]
public class DSASignatureFormatter : AsymmetricSignatureFormatter
{
/// Initializes a new instance of the class.
// Token: 0x06002F36 RID: 12086 RVA: 0x00098168 File Offset: 0x00096368
public DSASignatureFormatter()
{
}
/// Initializes a new instance of the class with the specified key.
/// The instance of the Digital Signature Algorithm () that holds the key.
///
/// is null.
// Token: 0x06002F37 RID: 12087 RVA: 0x00098170 File Offset: 0x00096370
public DSASignatureFormatter(AsymmetricAlgorithm key)
{
this.SetKey(key);
}
/// Creates the Digital Signature Algorithm () PKCS #1 signature for the specified data.
/// The digital signature for the specified data.
/// The data to be signed.
///
/// is null.
/// The OID is null.-or-The DSA key is null.
// Token: 0x06002F38 RID: 12088 RVA: 0x00098180 File Offset: 0x00096380
public override byte[] CreateSignature(byte[] rgbHash)
{
if (this.dsa == null)
{
throw new CryptographicUnexpectedOperationException(Locale.GetText("missing key"));
}
return this.dsa.CreateSignature(rgbHash);
}
/// Specifies the hash algorithm for the Digital Signature Algorithm () signature formatter.
/// The name of the hash algorithm to use for the signature formatter.
/// The parameter does not map to the hash algorithm.
// Token: 0x06002F39 RID: 12089 RVA: 0x000981AC File Offset: 0x000963AC
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 formatter.
/// The instance of that holds the key.
///
/// is null.
// Token: 0x06002F3A RID: 12090 RVA: 0x00098208 File Offset: 0x00096408
public override void SetKey(AsymmetricAlgorithm key)
{
if (key != null)
{
this.dsa = (DSA)key;
return;
}
throw new ArgumentNullException("key");
}
// Token: 0x04001347 RID: 4935
private DSA dsa;
}
}