简体   繁体   English

获取“ java.lang.SecurityException”

[英]Getting “java.lang.SecurityException”

I have a project in which I have these jars: 我有一个项目,其中有这些罐子:

  • bcprov-ext-jdk15-141.jar bcprov-ext-jdk15-141.jar
  • bcprov-jdk15-141.jar bcprov-jdk15-141.jar
  • bcmail-jdk14-136.jar bcmail-jdk14-136.jar

Problem 问题

Now I am using itextpdf-5.5.9.jar with bcprov-jdk15on-1.50.jar to generate password protected PDF but the problem is if I remove old bc jars it works fine but I have other code dependencies which uses previous 3 jars. 现在,我在itextpdf-5.5.9.jar使用bcprov-jdk15on-1.50.jar来生成受密码保护的PDF,但问题是如果我删除旧的bc jar,它可以正常工作,但是我还有其他依赖于以前3个jar的代码。

So if I keep these old jar I get 所以,如果我保留这些旧罐子,我会得到

java.lang.SecurityException: class "org.bouncycastle.asn1.ASN1Primitive"'s signer information does not match signer information of other classes in the same package. java.lang.SecurityException:类“ org.bouncycastle.asn1.ASN1Primitive”的签名者信息与同一包中其他类的签名者信息不匹配。

I think these jars are conflicting can anyone suggest some solution. 我认为这些罐子存在冲突,任何人都可以提出一些解决方案。

If you are using maven, just use the following dependency and it will automatically add the required org.bouncycastle » bcpkix-jdk15on 1.49 and org.bouncycastle » bcprov-jdk15on 1.49 automatically. 如果您正在使用maven,则只需使用以下依赖项,它将自动自动添加所需的org.bouncycastle»bcpkix-jdk15on 1.49和org.bouncycastle»bcprov-jdk15on 1.49。

<dependency>
    <groupId>com.itextpdf</groupId>
    <artifactId>itextpdf</artifactId>
    <version>5.5.9</version>
</dependency>

If you are not using maven then try using 1.49 org.bouncycastle jars. 如果您不使用Maven,请尝试使用1.49 org.bouncycastle jars。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM