异常SecurityException: JCE cannot authenticate the provider BC

升级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