android java, PBKDF2with8BIT implementation not found
redwave <[email protected]> Fri, 2 Aug 2019 00:08:57 -0500 (CDT)
| Newsgroups | gmane.comp.encryption.bouncy-castle.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I am developing with Box.net API (json web token[JWT]) on android and it
uses bouncycastle for decrypting its private key.
I had imported the following jar files:
bcpg-jdk15on-162.jar
bcpkix-jdk15on-162.jar
bcprov-ext-jdk15on-162.jar
bctls-jdk15on-162.jar
below is the code copied from the box.net example code.
Security.addProvider(new BouncyCastleProvider());
// Using BouncyCastle's PEMParser we convert the
// encrypted private key into a keypair object
PEMParser pemParser = new PEMParser(
new
StringReader(boxCredSettings.boxAppSettings.appAuth.privateKey)
);
Object keyPair = pemParser.readObject();
// Finally, we decrypt the key using the passphrase
char[] passphrase =
boxCredSettings.boxAppSettings.appAuth.passphrase.toCharArray();
JceOpenSSLPKCS8DecryptorProviderBuilder decryptBuilder =
new
JceOpenSSLPKCS8DecryptorProviderBuilder().setProvider("BC");
InputDecryptorProvider decryptProvider
= decryptBuilder.build(passphrase);
PrivateKeyInfo keyInfo
= ((PKCS8EncryptedPrivateKeyInfo)
keyPair).decryptPrivateKeyInfo(decryptProvider);
// In the end, we will use this key in the next steps
key = (new JcaPEMKeyConverter()).getPrivateKey(keyInfo);
pemParser.close();
The error is from decryptPrivateKeyInfo() function.
here is the following error:
org.bouncycastle.pkcs.PKCSException: unable to read encrypted data:
1.2.840.113549.1.5.13 not available: SecretKeyFactory PBKDF2with8BIT
implementation not found
--
Sent from: http://bouncy-castle.1462172.n4.nabble.com/Bouncy-Castle-Dev-f1462173.html