Skip to main content
Security.addProvider(new BouncyCastleProvider());



PEMParser pemParser = new PEMParser(

new StringReader(config.boxAppSettings.appAuth.privateKey)

);

Object keyPair = pemParser.readObject();

pemParser.close();



the keyPair return null?

Hi @moaldini , welcome to the forum!



If you got the private key from Box while setting up the JWT application, please note the private key is encrypted.



You can extract it using something like:



openssl rsa -in your_encrypted_private-key-file.pem -out decrypted-private-key-file.pem  -passin pass:your-pass-phrase





Most likely Bouncy Caste will also have methods to decrypt a private key.



Let us know if this helps


Reply