最近用到 国密sm3算法,报错 java.lang.SecurityException: class "org.bouncycastle.crypto.digests.GeneralDigest"'s signer information does not match signer information of other classes in the same package
一、原因
jar 包冲突
二、解决
*尝试方案一:
项目是maven项目,使用命令:dependency:tree -Dverbose -Dincludes=:bcprov-jdk
找出此bcprov-jdk14-136.jar包的依赖关系,如下所示:
mvn dependency:tree -Dverbose -Dincludes=:bcprov-jdk
[INFO] Verbose not supported since maven-dependency-plugin 3.0
。。。
提示不支持,继续尝试
*尝试方案二:
dependency:tree
手动查找 关键词bcprov-jdk
涉及到的jar,进行排除即可:
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
</exclusions>
三、排查问题用到的几个点:
org/bouncycastle/crypto/digests/SM3Digest
<!--<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15to18</artifactId>
<version>1.68</version>
</dependency>-->
<!--<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.60</version>
</dependency>-->
The server license is out of date