Example #1
0
        public X509Certificate SignWith(X509PrivateKey authorityPrivateKey)
        {
            var tbsData = Tbs.ToAsn1().GetBytes();
            var data    = authorityPrivateKey.SignData(tbsData);

            SignatureValue     = new Asn1BitString(data);
            SignatureAlgorithm = Tbs.SignatureAlgorithm;
            return(this);
        }
Example #2
0
        public X509Certificate GenerateRsaKey(int keySize = 2048)
        {
            var privateKey = new RsaPrivateKey(keySize);
            var publicKey  = privateKey.CreatePublicKey();

            Tbs.SubjectPublicKeyInfo = publicKey.GetSubjectPublicKeyInfo();
            PrivateKey = privateKey;
            return(SetSubjectKeyIdentifier());
        }
Example #3
0
 public X509Certificate SetPrivateKey(X509PrivateKey privateKey)
 {
     this.PrivateKey = privateKey;
     return(this);
 }