コード例 #1
0
        /// <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);
        }
コード例 #2
0
        public IStreamCalculator CreateCalculator()
        {
            ISigner sig = SignerUtilities.GetSigner(X509Utilities.GetSignatureName(algID));

            sig.Init(false, publicKey);

            return(new VerifierCalculator(sig));
        }
コード例 #3
0
        /// <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);
        }