使用RSAES-OAEP加密电子邮件& AES

时间:2017-03-14 16:40:34

标签: java encryption x509certificate bouncycastle smime

我使用Bouncycastle SMIME包使用rsassa-pss证书加密邮件:

openssl x509 -text -in certificate.crt | grep -i "algorithm"
Signature Algorithm: rsassaPss
     Hash Algorithm: sha256
     Mask Algorithm: mgf1 with sha256

我试过了:

public void encrypt(Collection<X509Certificate> certs)  {
    OutputEncryptor enc = new BcCMSContentEncryptorBuilder(CMSAlgorithm.AES192_CBC).build();
    SMIMEEnvelopedGenerator gen = new SMIMEEnvelopedGenerator();

    for (X509Certificate nCert : certs) {
         gen.addRecipientInfoGenerator(
         new JceKeyTransRecipientInfoGenerator(nCert, new AlgorithmIdentifier(PKCSObjectIdentifiers.id_RSAES_OAEP))
                .setProvider("BC"));
}

但它不起作用。有什么想法吗?

0 个答案:

没有答案