JCRCaused 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
Caused by: cn.hutool.crypto.CryptoException: SecurityException: JCE cannot authenticate the provider BC
at cn.hutool.crypto.SecureUtil.createCipher(SecureUtil.java:1029)
at cn.hutool.crypto.asymmetric.AsymmetricCrypto.initCipher(AsymmetricCrypto.java:317)
at cn.hutool.crypto.asymmetric.RSA.initCipher(RSA.java:211)
at cn.hutool.crypto.asymmetric.AsymmetricCrypto.init(AsymmetricCrypto.java:220)
at cn.hutool.crypto.asymmetric.AsymmetricCrypto.init(AsymmetricCrypto.java:34)
at cn.hutool.crypto.asymmetric.BaseAsymmetric.<init>(BaseAsymmetric.java:54)
at cn.hutool.crypto.asymmetric.AbstractAsymmetricCrypto.<init>(AbstractAsymmetricCrypto.java:39)
at cn.hutool.crypto.asymmetric.AsymmetricCrypto.<init>(AsymmetricCrypto.java:155)
at cn.hutool.crypto.asymmetric.AsymmetricCrypto.<init>(AsymmetricCrypto.java:137)
at cn.hutool.crypto.asymmetric.AsymmetricCrypto.<init>(AsymmetricCrypto.java:86)
at cn.hutool.crypto.asymmetric.RSA.<init>(RSA.java:87)
at com.bocloud.devops.utils.RSAUtil.<init>(RSAUtil.java:16)
at com.bocloud.devops.encrypt.config.RSAConfig.rsaUtil(RSAConfig.java:25)
at com.bocloud.devops.encrypt.config.RSAConfig$$EnhancerBySpringCGLIB$$93b07a93.CGLIB$rsaUtil$0(<generated>)
at com.bocloud.devops.encrypt.config.RSAConfig$$EnhancerBySpringCGLIB$$93b07a93$$FastClassBySpringCGLIB$$dce9d6e8.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
at com.bocloud.devops.encrypt.config.RSAConfig$$EnhancerBySpringCGLIB$$93b07a93.rsaUtil(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 59 common frames omittedCaused 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:1027)
... 81 common frames omitted
Caused by: java.util.jar.JarException: file:/D:/maven-repository/bouncycastle/bcprov-jdk14/138/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)
... 82 common frames omitted
原因:
高版本的jdk引起的加密包报错,可以编译代码,然后找到bcprov-jdk高版本的jar包,复制到java/jdk版本号/jre/lib/ext目录下
文章来源:https://www.toymoban.com/news/detail-764153.html
目前我的java版本是1.8.0_391
如果不行,需要修改Java\jdk-1.8\jre\lib\security目录下java.security文件
添加security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider
文章来源地址https://www.toymoban.com/news/detail-764153.html
到了这里,关于JCE cannot authenticate the provider BC因jdk版本引起的加密包报错的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!