public PKCS12KeyStore(string keyAlias, RSAKeyPair keyPair, X509CertificateBase certificate) { m_KeyStore = new Pkcs12StoreBuilder().SetUseDerEncoding(true).Build(); m_KeyStore.SetKeyEntry(keyAlias, new AsymmetricKeyEntry(PrivateKeyFactory.CreateKey(keyPair.PrivateKey)), new[] { new X509CertificateEntry(new X509CertificateParser().ReadCertificate(certificate.GetEncoded())) }); }
public static RSAKeyPair Encrypt(string passphrase, RSAKeyPair keyPair) { var salt = new byte[20]; new SecureRandom().NextBytes(salt); return(new RSAKeyPair(keyPair.PublicKey, EncryptedPrivateKeyInfoFactory.CreateEncryptedPrivateKeyInfo(PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc.Id, passphrase.ToArray(), salt, 1024, PrivateKeyInfo.GetInstance(keyPair.PrivateKey)).GetDerEncoded(), true)); }
public static OneAsymmetricKeyInfo CreateOneAsymmetricKeyInfo(RSAKeyPair keyPair) { return(CreateOneAsymmetricKeyInfo(PrivateKeyInfo.GetInstance(keyPair.PrivateKey), SubjectPublicKeyInfo.GetInstance(keyPair.PublicKey))); }
public override CertificateRevocationListBase Generate(RSAKeyPair keyPair) { var r = m_Generator.Generate(PrivateKeyFactory.CreateKey(keyPair.PrivateKey)); return(new CertificateRevocationListBC(new MemoryStream(r.GetEncoded()))); }
public abstract CertificateRevocationListBase Generate(RSAKeyPair keyPair);