解析Box Developer Edition的PKCS私钥时出错

时间:2017-11-28 22:36:02

标签: java box

我一直在使用Eclipse Neon,并且通过他们的API在Java中访问Box有一个正常运行的程序。我将程序导入Eclipse Oxygen以及相同的Java JRE SE1.8。

当我运行程序时,我得到了解析错误。任何人都知道造成这种情况的原因是什么?

下面的堆栈跟踪:

An error occurred: Unable to authenticate using the box config file: Error parsing PKCS private key for Box Developer Edition.
com.lmsnet.box.exception.BoxException: Unable to authenticate using the box config file: Error parsing PKCS private key for Box Developer Edition.
    at com.lmsnet.box.service.BoxService.<init>(BoxService.java:41)
    at com.lmsnet.box.BoxApplication.main(BoxApplication.java:48)
Caused by: com.box.sdk.BoxAPIException: Error parsing PKCS private key for Box Developer Edition.
    at com.box.sdk.BoxDeveloperEditionAPIConnection.decryptPrivateKey(BoxDeveloperEditionAPIConnection.java:452)
    at com.box.sdk.BoxDeveloperEditionAPIConnection.constructJWTAssertion(BoxDeveloperEditionAPIConnection.java:390)
    at com.box.sdk.BoxDeveloperEditionAPIConnection.authenticate(BoxDeveloperEditionAPIConnection.java:300)
    at com.box.sdk.BoxDeveloperEditionAPIConnection.getAppUserConnection(BoxDeveloperEditionAPIConnection.java:231)
    at com.box.sdk.BoxDeveloperEditionAPIConnection.getAppUserConnection(BoxDeveloperEditionAPIConnection.java:263)
    at com.lmsnet.box.service.BoxService.<init>(BoxService.java:37)
    ... 1 more
Caused by: org.bouncycastle.pkcs.PKCSException: unable to read encrypted data: 1.2.840.113549.1.5.13 not available: Illegal key size
    at org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo.decryptPrivateKeyInfo(Unknown Source)
    at com.box.sdk.BoxDeveloperEditionAPIConnection.decryptPrivateKey(BoxDeveloperEditionAPIConnection.java:441)
    ... 6 more
Caused by: org.bouncycastle.operator.OperatorCreationException: 1.2.840.113549.1.5.13 not available: Illegal key size
    at org.bouncycastle.openssl.jcajce.JceOpenSSLPKCS8DecryptorProviderBuilder$1.get(Unknown Source)
    ... 8 more
Caused by: java.security.InvalidKeyException: Illegal key size
    at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)
    at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1060)
    at javax.crypto.Cipher.init(Cipher.java:1536)
    at javax.crypto.Cipher.init(Cipher.java:1470)
    ... 9 more

1 个答案:

答案 0 :(得分:0)

想出来。完全尴尬。我的Eclipse Neon指向我的dev文件夹中的当前jre,Eclipse Oxygen指向没有JCE jar的旧安装。唉

感谢您的帮助!