Re: android java, PBKDF2with8BIT implementation not found

cryptearth <[email protected]> Fri, 2 Aug 2019 17:49:39 +0200
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <[email protected]>
Hey,

Android ships with its own modified/cut-down version of BouncyCastle not 
contain all the "normal" release has - hence a fork "SpongyCastle" was 
done wich provides a "re-release" of BC on a different name scheme to 
avoid conflicts. Give it a try.

Matt

Am 02.08.2019 um 07:08 schrieb redwave:
> 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
>