接入第三方验签包报错org.bouncycastle.jce.provider.BouncyCastleProvider&org/bouncycastle/cms/CMSTypedData

  • 2019-01-17
  • 0
  • 0

对接某东提供的第三方数字验签工具包,报错:

ava.lang.ClassNotFoundException:org.bouncycastle.jce.provider.BouncyCastleProvider

对方提供的demo中运行是可以的,排除修改本地jdk的可能,查看对方demo,发现少引入了两个依赖包

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

后报错

java.lang.NoClassDefFoundError: org/bouncycastle/cms/CMSTypedData

发现是依赖版本问题,直接修改为1.49即可

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

评论

还没有任何评论,你来说两句吧