/**
* Creates an ExternalSignature instance
* @param pk a PrivateKey object
* @param hashAlgorithm the hash algorithm (e.g. "SHA-1", "SHA-256",...)
* @param provider the security provider (e.g. "BC")
*/
public PrivateKeySignature(ICipherParameters pk, String hashAlgorithm)
{
this.pk = pk;
this.hashAlgorithm = DigestAlgorithms.GetDigest(DigestAlgorithms.GetAllowedDigests(hashAlgorithm));
if (pk is RsaKeyParameters)
{
encryptionAlgorithm = "RSA";
}
else if (pk is DsaKeyParameters)
{
encryptionAlgorithm = "DSA";
}
else
{
throw new ArgumentException(MessageLocalization.GetComposedMessage("unknown.key.algorithm.1", pk.ToString()));
}
}