bcprov-jdk14、15on、16冲突,导致的签名不匹配。GeneralDigest signer information does not match
前言:
今天在迁移一个项目,结果成功启动,但是在登录的时候,提示如下错误!翻译发现是因为签名不匹配。百度说是因为jar包冲突了。
错误提示
java.lang.SecurityException: class “org.bouncycastle.crypto.digests.GeneralDigest”'s signer information does not match signer information of other classes in the same package
排查
- 原来这个resources下面的libs中我手动导入了这个
bcprov-jdk16-145.jar。

- 删除16版本后,再次build,启动项目发现还是不行。在外部库中查找,果然有冲突的。

- 用gradle下help的dependencies来分析一下。结果在
tencentyun:tls-sig-api包中依赖了bcpkix-jdk15on,在org.xhtmlrenderer:flying-saucer-pdf中依赖了bouncycastle:bcprov-jdk14。那么我们排除org.xhtmlrenderer:flying-saucer-pdf中的bouncycastle:bcprov-jdk14。

+--- com.github.tencentyun:tls-sig-api:1.2
| +--- org.bouncycastle:bcpkix-jdk15on:1.59
| | \--- org.bouncycastle:bcprov-jdk15on:1.59
| +--- org.bouncycastle:bcprov-jdk15on:1.59
| \--- org.json:json:20180130
+--- org.xhtmlrenderer:flying-saucer-pdf:9.0.3
| +--- com.lowagie:itext:2.1.7
| | +--- bouncycastle:bcmail-jdk14:138
| | +--- bouncycastle:bcprov-jdk14:138
| | \--- bouncycastle:bctsp-jdk14:138
| | \--- org.bouncycastle:bctsp-jdk14:1.38
| | \--- org.bouncycastle:bcmail-jdk14:1.38
| \--- org.xhtmlrenderer:flying-saucer-core:9.0.3
- 修改build.gradle
compile('org.xhtmlrenderer:flying-saucer-pdf:9.0.3'){
exclude group: 'bouncycastle', module: 'bcprov-jdk14'
exclude group: 'org.bouncycastle', module: 'bcprov-jdk14'
}

本文来自博客园,作者:Huathy,遵循 CC 4.0 BY-NC-SA 版权协议。转载请注明原文链接:https://www.cnblogs.com/huathy/p/17253819.html

浙公网安备 33010602011771号