/// <summary> /// Base constructor. /// </summary> /// <param name="algorithm">The name of the signature algorithm to use.</param> /// <param name="publicKey">The public key to be used in the verification operation.</param> public Asn1VerifierFactory(String algorithm, AsymmetricKeyParameter publicKey) { DerObjectIdentifier sigOid = X509Utilities.GetAlgorithmOid(algorithm); this.publicKey = publicKey; this.algID = X509Utilities.GetSigAlgID(sigOid, algorithm); }
/// <summary> /// Constructor which also specifies a source of randomness to be used if one is required. /// </summary> /// <param name="algorithm">The name of the signature algorithm to use.</param> /// <param name="privateKey">The private key to be used in the signing operation.</param> /// <param name="random">The source of randomness to be used in signature calculation.</param> public Asn1SignatureFactory(string algorithm, AsymmetricKeyParameter privateKey, SecureRandom random) { DerObjectIdentifier sigOid = X509Utilities.GetAlgorithmOid(algorithm); this.algorithm = algorithm; this.privateKey = privateKey; this.random = random; this.algID = X509Utilities.GetSigAlgID(sigOid, algorithm); }
/// <summary> /// Base constructor. /// </summary> /// <param name="algorithm">The name of the signature algorithm to use.</param> /// <param name="publicKey">The public key to be used in the verification operation.</param> public Asn1VerifierFactory(string algorithm, AsymmetricKeyParameter publicKey) { if (algorithm == null) { throw new ArgumentNullException("algorithm"); } if (publicKey == null) { throw new ArgumentNullException("publicKey"); } if (publicKey.IsPrivate) { throw new ArgumentException("Key for verifying must be public", "publicKey"); } DerObjectIdentifier sigOid = X509Utilities.GetAlgorithmOid(algorithm); this.publicKey = publicKey; this.algID = X509Utilities.GetSigAlgID(sigOid, algorithm); }
/// <summary> /// Constructor which also specifies a source of randomness to be used if one is required. /// </summary> /// <param name="algorithm">The name of the signature algorithm to use.</param> /// <param name="privateKey">The private key to be used in the signing operation.</param> /// <param name="random">The source of randomness to be used in signature calculation.</param> public Asn1SignatureFactory(string algorithm, AsymmetricKeyParameter privateKey, SecureRandom random) { if (algorithm == null) { throw new ArgumentNullException("algorithm"); } if (privateKey == null) { throw new ArgumentNullException("privateKey"); } if (!privateKey.IsPrivate) { throw new ArgumentException("Key for signing must be private", "privateKey"); } DerObjectIdentifier sigOid = X509Utilities.GetAlgorithmOid(algorithm); this.algorithm = algorithm; this.privateKey = privateKey; this.random = random; this.algID = X509Utilities.GetSigAlgID(sigOid, algorithm); }