更新到Bouncycastle版本1.56后的证书问题

时间:2018-01-11 14:08:25

标签: java certificate bouncycastle public-key

我们已将我们的Bouncycastle版本从1.55更新为1.56。在此之后,我们的证书之一出现问题。现在有人为什么会出现这个问题?

caused by: java.lang.IllegalArgumentException: invalid info structure in RSA public key                                    
at org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey.populateFromPublicKeyInfo(Unknown Source)               
at org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPublicKey.<init>(Unknown Source)                                  
at org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi.generatePublic(Unknown Source)                            
at org.bouncycastle.jce.provider.BouncyCastleProvider.getPublicKey(Unknown Source)                                        
at org.bouncycastle.jcajce.provider.asymmetric.x509.X509CertificateObject.getPublicKey(Unknown Source)                     
at org.bouncycastle.jcajce.provider.keystore.pkcs12.PKCS12KeyStoreSpi.engineLoad(Unknown Source)                          
at java.security.KeyStore.load(KeyStore.java:1456)`

(修订版)

使用提供程序Bouncycastle加载KeyStore时会出现问题。

  keyStore = KeyStore.getInstance("PKCS12", new BouncyCastleProvider());
        keyStore.load(inputStream, "test".toCharArray());

经测试的东西:

使用KeyStoreExplorer 5.3.0重新导入证书 - &gt;相同的问题,5.1.1 - &gt;成功导入

RSA公钥是否有新的验证?

1 个答案:

答案 0 :(得分:0)

我发现了问题。问题是Bouncycastle 1.56使用Java 8,因此不再接受密钥大小小于1024的证书。