Error parsing PKCS private key for Box Developer Edition.
I am getting this exception while creating BoxConfig.
Error parsing PKCS private key for Box Developer Edition.\"; nested exception is com.box.sdk.BoxAPIException: Error parsing PKCS private key for Box Developer Edition
...
com.box.sdk.BoxAPIException: Error parsing PKCS private key for Box Developer Edition.\r\n\tat com.box.sdk.BoxDeveloperEditionAPIConnection.decryptPrivateKey(BoxDeveloperEditionAPIConnection.java:667)\r\n\tat com.box.sdk.BoxDeveloperEditionAPIConnection.constructJWTAssertion(BoxDeveloperEditionAPIConnection.java:602)\r\n\tat com.box.sdk.BoxDeveloperEditionAPIConnection.authenticate(BoxDeveloperEditionAPIConnection.java:431)\r\n\tat com.box.sdk.BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(BoxDeveloperEditionAPIConnection.java:193)\r\n\tat com.box.sdk.BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(BoxDeveloperEditionAPIConnection.java:232)\r\n\tat com.blackberry.enterprise.casb.box.service.BoxConnectionService.getEnterpriseConnectionByConfig(BoxConnectionService.java:132)\r\n\t... 38 common frames omitted\r\nCaused by: org.bouncycastle.pkcs.PKCSException: unable to read encrypted data: 1.2.840.113549.1.5.13 not available: JCE cannot authenticate the provider BC\r\n\tat org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo.decryptPrivateKeyInfo(Unknown Source)\r\n\tat com.box.sdk.BoxDeveloperEditionAPIConnection.decryptPrivateKey(BoxDeveloperEditionAPIConnection.java:656)\r\n\t... 43 common frames omitted\r\nCaused by: org.bouncycastle.operator.OperatorCreationException: 1.2.840.113549.1.5.13 not available: JCE cannot authenticate the provider BC\r\n\tat org.bouncycastle.openssl.jcajce.JceOpenSSLPKCS8DecryptorProviderBuilder$1.get(Unknown Source)\r\n\t... 45 common frames omitted\r\nCaused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC\r\n\tat java.base/javax.crypto.JceSecurity.getInstance(JceSecurity.java:131)\r\n\tat java.base/javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:208)\r\n\tat org.bouncycastle.jcajce.util.NamedJcaJceHelper.createSecretKeyFactory(Unknown Source)\r\n\tat org.bouncycastle.openssl.jcajce.PEMUtilities.generateSecretKeyForPKCS5Scheme2(Unknown Source)\r\n\t... 46 common frames omitted\r\nCaused by: java.lang.IllegalStateException: zip file closed\r\n\tat java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:831)\r\n\tat java.base/java.util.zip.ZipFile.getManifestName(ZipFile.java:1057)\r\n\tat java.base/java.util.zip.ZipFile$1.getManifestName(ZipFile.java:1100)\r\n\tat java.base/javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:461)\r\n\tat java.base/javax.crypto.JarVerifier.verifyJars(JarVerifier.java:317)\r\n\tat java.base/javax.crypto.JarVerifier.verify(JarVerifier.java:260)\r\n\tat java.base/javax.crypto.ProviderVerifier.verify(ProviderVerifier.java:130)\r\n\tat java.base/javax.crypto.JceSecurity.verifyProvider(JceSecurity.java:190)\r\n\tat java.base/javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:218)\r\n\tat java.base/javax.crypto.JceSecurity.getInstance(JceSecurity.java:128)\r\n\t... 49 common frames omitted\r\n"
I have followed all the steps given below but no change. Could anybody help.
-
Hi Durgesh,
I can't tell what's going on just by looking at the error dump.
Looks like the error is in using the private key which points me to something related with JWT.
Are you using JWT as a server side authentication?
I had a similar situation when I tried to configure JWT access manually as opposed to using the config.json file provided, and it was due to an error in creating the private key file from the config.json (all those \n), so it didn't parsed correctly.
So if you are loading the config.json file and using the java sdk take a look here and here.
Let us know if this helps.
Post is closed for comments.
Comments
1 comment