public override byte[] SignData(ProtocolVersion version, byte[] data, HashAlgorithm hashAlgorithm, CertificatePrivateKey privateKey)
{
if (hashAlgorithm != null && !(hashAlgorithm is SHA1)) {
throw new Exception("DSA signature requires SHA1 hash algorithm");
}
if (!(privateKey.Algorithm is DSACryptoServiceProvider)) {
throw new Exception("DSA signature requires DSA private key");
}
DSACryptoServiceProvider dsaKey = (DSACryptoServiceProvider) privateKey.Algorithm;
if (dsaKey.PublicOnly) {
throw new Exception("DSA private key required for signing");
}
return DEREncodeSignature(dsaKey.SignData(data));
}