has unsigned entries - org/bouncycastle/LICENSE.class
报错信息如下:
cn.hutool.crypto.CryptoException: SecurityException: JCE cannot authenticate the provider BC
at cn.hutool.crypto.SecureUtil.createCipher(SecureUtil.java:1017)
at cn.hutool.crypto.CipherWrapper.<init>(CipherWrapper.java:39)
at cn.hutool.crypto.symmetric.SymmetricCrypto.init(SymmetricCrypto.java:150)
at cn.hutool.crypto.symmetric.SymmetricCrypto.<init>(SymmetricCrypto.java:127)
at cn.hutool.crypto.symmetric.AES.<init>(AES.java:190)
at cn.hutool.crypto.symmetric.AES.<init>(AES.java:132)
.......
Caused by: java.lang.SecurityException: JCE cannot authenticate the provider BC
at javax.crypto.Cipher.getInstance(Cipher.java:662)
at cn.hutool.crypto.SecureUtil.createCipher(SecureUtil.java:1015)
... 122 more
Caused by: java.util.jar.JarException: jar:file:/app/xscloud/xs-system.jar!/BOOT-INF/lib/bcprov-jdk14-138.jar!/ has unsigned entries - org/bouncycastle/LICENSE.class
at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:510)
at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:371)
at javax.crypto.JarVerifier.verify(JarVerifier.java:297)
at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:164)
at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:190)
at javax.crypto.Cipher.getInstance(Cipher.java:658)
... 123 more
排查发现,项目打包后依赖包存在:
bcprov-jdk14-1.38.jar
bcprov-jdk14-138.jar
bcprov-jdk15on-1.62.jar
然后将bcprov-jdk15on-1.62.jar复制到/usr/java/jdk1.8.0_371/jre/lib/ext目录,然后重启应用即可。
这个问题与高版本的JDK有关系,同样的部署包在jdk1.8.0_281下正常。