문제

How can i create a new instance of org.bouncycastle.asn1.x509.AlgorithmIdentifier of RSA OAEP? in order to be able to use it here:

JceKeyTransRecipientInfoGenerator(java.security.cert.X509Certificate recipientCert, org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier)
도움이 되었습니까?

해결책

with current BouncyCastleVersions you can use a constant from org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers

AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(PKCSObjectIdentifiers.id_RSAES_OAEP);

다른 팁

It is as simple as creating object from string representation of RSA with OAEP oid

AlgorithmIdentifier id = AlgorithmIdentifier.getInstance("1.2.840.113549.1.1.7");

in recent versions of BouncyCastle >1.50 this API has been removed and getInstance takes only ASN1Sequence and AlgorithmIdentifier. So there is no option, but to use constructor:

AlgorithmIdentifier id = new AlgorithmIdentifier(PKCSObjectIdentifiers.id_RSAES_OAEP);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top