I am trying to decrypt the pkcs8 encrypted secret key using a bouncy castle library. I analyzed the file containing the private key using the PEMParserprovided PEMParsercastle. I got the object PKCS8EncryptedPrivateKeyInfo. I cannot get an object PrivateKeyInfofrom this. I get the following exception when trying to decrypt.
org.bouncycastle.pkcs.PKCSException: unable to read encrypted data: 1.2.840.113549.1.5.13 not available: no such provider: 1.2.840.113549.1.5.13
here is the code i used
PEMParser parser = new PEMParser(br);
PKCS8EncryptedPrivateKeyInfo pair = (PKCS8EncryptedPrivateKeyInfo)parser.readObject();
JceOpenSSLPKCS8DecryptorProviderBuilder jce = new JceOpenSSLPKCS8DecryptorProviderBuilder();
jce.setProvider("1.2.840.113549.1.5.13");
InputDecryptorProvider decProv = jce.build(password.toCharArray());
PrivateKeyInfo info = pair.decryptPrivateKeyInfo(decProv);
source
share