コード例 #1
0
        public CertificateWithKey Generate(AsymmetricCipherKeyPair signerKeyPair)
        {
            Validate();

            ISignatureFactory signatureFactory = new Asn1SignatureFactory(SignatureAlgorithm, signerKeyPair.Private, random);

            certificateGenerator.SetPublicKey(keyPair.Public);

            X509Certificate certificate = certificateGenerator.Generate(signatureFactory);

            certificate.Verify(signerKeyPair.Public);
            var x509 = new X509Certificate2(certificate.GetEncoded());

            var result = new CertificateWithKey
            {
                Certificate = x509,
                KeyPair     = keyPair
            };

            return(result);
        }
コード例 #2
0
ファイル: CrlBuilder.cs プロジェクト: Alger23/TestAuthority
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="random">Random value.</param>
 /// <param name="signerCertificate">Signers certificate.</param>
 public CrlBuilder(SecureRandom random, CertificateWithKey signerCertificate)
 {
     this.random            = random;
     this.signerCertificate = signerCertificate;
 }