如何创建RSA OAEP org.bouncycastle.asn1.x509.AlgorithmIdentifier
的新实例?为了能够在这里使用它:
JceKeyTransRecipientInfoGenerator(java.security.cert.X509Certificate recipientCert, org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier)
答案 0 :(得分:4)
使用当前的BouncyCastleVersions,您可以使用org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(PKCSObjectIdentifiers.id_RSAES_OAEP);
答案 1 :(得分:2)
就像使用OAEP oid
从RSA的字符串表示创建对象一样简单AlgorithmIdentifier id = AlgorithmIdentifier.getInstance("1.2.840.113549.1.1.7");
在最新版本的BouncyCastle> 1.50中,此API已被删除,getInstance仅采用ASN1Sequence和AlgorithmIdentifier。所以没有选择,只能使用构造函数:
AlgorithmIdentifier id = new AlgorithmIdentifier(PKCSObjectIdentifiers.id_RSAES_OAEP);