【异常】SecurityException: JCE cannot authenticate the provider BC

发布时间:2024年01月20日

升级JDK21出现该异常

JCRCaused by: java.util.jar.JarException: jar:file:/app//service.jar!/BOOT-INF/lib/bcprov-jdk14-138.jar!/ has unsigned entries - org/bouncycastle/LICENSE.class
?

解决方案

排除

bcprov-jdk14 依赖  可以通过maven插件去查找
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>

			<exclusions>
				<exclusion>
					<artifactId>bcprov-jdk14</artifactId>
					<groupId>bouncycastle</groupId>
				</exclusion>
				<exclusion>
					<artifactId>bcprov-jdk14</artifactId>
					<groupId>org.bouncycastle</groupId>
				</exclusion>
			</exclusions>
        </dependency>



添加依赖

        <!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on -->
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk18on</artifactId>
            <version>1.77</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.bouncycastle/bcpkix-jdk18on -->
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk18on</artifactId>
            <version>1.77</version>
        </dependency>

		<dependency>
			<groupId>org.bouncycastle</groupId>
			<artifactId>bcprov-jdk15on</artifactId>
			<version>1.70</version>
		</dependency>

清理maven?

install maven

OK

文章来源:https://blog.csdn.net/G971005287W/article/details/135722257
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。