首页 > 基础资料 博客日记
JCE cannot authenticate the provider BC因jdk版本引起的加密包报错
2024-04-12 08:00:09基础资料围观376次
文章JCE cannot authenticate the provider BC因jdk版本引起的加密包报错分享给大家,欢迎收藏Java资料网,专注分享技术知识
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目录下
目前我的java版本是1.8.0_391
如果不行,需要修改Java\jdk-1.8\jre\lib\security目录下java.security文件
添加security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider
文章来源:https://blog.csdn.net/ruantiao3440/article/details/134284747
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:jacktools123@163.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:jacktools123@163.com进行投诉反馈,一经查实,立即删除!
标签: