public X509Certificate SignWith(X509PrivateKey authorityPrivateKey) { var tbsData = Tbs.ToAsn1().GetBytes(); var data = authorityPrivateKey.SignData(tbsData); SignatureValue = new Asn1BitString(data); SignatureAlgorithm = Tbs.SignatureAlgorithm; return(this); }
public X509Certificate GenerateRsaKey(int keySize = 2048) { var privateKey = new RsaPrivateKey(keySize); var publicKey = privateKey.CreatePublicKey(); Tbs.SubjectPublicKeyInfo = publicKey.GetSubjectPublicKeyInfo(); PrivateKey = privateKey; return(SetSubjectKeyIdentifier()); }
public X509Certificate SetPrivateKey(X509PrivateKey privateKey) { this.PrivateKey = privateKey; return(this); }