Hi,
we are using java1.8 version and trying to get the Token using Java SDK , but we got the below exception.
above blog suggeste all the jar’s added.
Sample Code:
Path configPath = Paths.get(“config.json”);
try (BufferedReader reader = Files.newBufferedReader(configPath, Charset.forName(“UTF-8”))) {
BoxConfig boxConfig = BoxConfig.readFrom(reader);
BoxDeveloperEditionAPIConnection client = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig);
//Not able to get this token
System.out.println(client.getAccessToken());
}catch(Exception e){
System.out.println(“Error =”+e.getMessage());
}
This below exception, we are getting recently.
Exception in thread “main” com.box.sdk.BoxAPIException: Error parsing PKCS private key for Box Developer Edition.
at com.box.sdk.BoxDeveloperEditionAPIConnection.decryptPrivateKey(BoxDeveloperEditionAPIConnection.java:568)
Caused by: org.bouncycastle.pkcs.PKCSException: unable to read encrypted data: javax.crypto.BadPaddingException: pad block corrupted
Caused by: java.io.IOException: javax.crypto.BadPaddingException: pad block corrupted
at javax.crypto.CipherInputStream.getMoreData(CipherInputStream.java:128)
at javax.crypto.CipherInputStream.read(CipherInputStream.java:246)
at org.bouncycastle.util.io.Streams.pipeAll(Unknown Source)
Regards,
Srinivas.