- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在开发一个给 PDF 加水印的小工具,它适用于某些 PDF,但对某些其他 PDF 会崩溃。
我正在使用 iText 库和 bouncycaSTLe(依赖项)
pom.xml:
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.6</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.49</version>
</dependency>
它在这一行(代码的第一行)崩溃:
PdfReader reader = new PdfReader(src);
使用以下堆栈跟踪:
Exception in thread "main" com.itextpdf.text.exceptions.InvalidPdfException: class "org.bouncycastle.asn1.ASN1Primitive"'s signer information does not match signer information of other classes in the same package
at com.itextpdf.text.pdf.PdfReader.readPdf(PdfReader.java:727)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:181)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:219)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:207)
at com.itextpdf.text.pdf.PdfReader.<init>(PdfReader.java:197)
... <from here it points to my code>
我做了一些谷歌搜索,有些人说可能的问题是我在某处复制了这个bouncycaSTLe lib。
这是在使用 Maven 构建的 Spring 应用程序中。那么,这真的是图书馆的问题吗?
我正在使用 JDK 1.8。
我尝试过的:
但行为完全相同,一些 PDF 有效(总是)而另一些 不(永远).
您在使用 iText 库时是否遇到过与此类似的问题?
是问题在导致代码崩溃的PDF文件吗而不是在我的项目中?
我完全被困在这里,所以任何帮助/提示将不胜感激。提前致谢。
最佳答案
感谢 Bruno Lowagie 的评论和相关问题以及mkl 提示,我找到了问题。
在我的构建路径中,有两个 org.bouncycaSTLe 库,其中一个是我通过 Maven 添加的(bcprov-jdk15on.jar
) 和 Pivotal TC Server 使用的另一个 (com.springsource.org.bouncycaSTLe.jce-1.46.0.jar
)。
我已经删除 Pivotal TC Server bouncycaSTLe jar 并且错误已经消失。。 p>
使用 STS 我无法删除它,所以我在文件系统上找到它并从 Pivotal TC 预期的文件夹中移出。然后,这个lib在STS就消失了。
我没有删除它以防万一,只是移动到另一个目录。如果我从现在开始在使用 Pivotal TC 时遇到问题,我会更新我的答案。
关于java - 'class "org.bouncycaSTLe.asn1.ASN1Primitive"'s signer information does not match signer information of other classes in the same package' 使用 Itext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43213776/
我想使用 asn.1 实现一些协议(protocol),所以我必须在一些头文件中声明结构和标记名称,并将 asn.1 的编码规则作为函数实现。 你能给我推荐一些教程或书来引用吗? 我不知道如何为它编写
我正在寻找非常通用、严格且与平台无关的序列化框架。我发现了一个叫做 ASN.1 的东西。 它看起来像与序列化有关的东西,但我实际上无法理解它是什么。我阅读了维基百科文章和 ITU article但仍然
这些编码在 ASN.1 INTEGER 类型中是否相同? 编码十进制 10 02 01 0A 02 02 00 0A 02 03 00 00 0A ... 最佳答案 我假设您正在使用 BER。 INT
一个 ASN.1 标签由两个类位组成,一个是形式位和一个标签号。我的问题是:标签唯一性是什么就足够了?是否足够,类和编号是唯一的,还是还需要包含标签形式?或者反过来:是否有两个不同的标签具有相同的标签
这是一个用 ASN.1 DER 编码的证书示例 30 82 01 8F 30 81 F9 **A0** 03 02 01 02 02 01 01 30 0D 06 09 2A 86 48 86 F7
这是一个用 ASN.1 DER 编码的证书示例 30 82 01 8F 30 81 F9 **A0** 03 02 01 02 02 01 01 30 0D 06 09 2A 86 48 86 F7
我收到了一份 ASN.1 文档,其中包含两个编码/解码属性; 自动标签 我的理解;标签是使用编码规则自动定义的,除非定义中存在标签符号 隐含的可扩展性 我的理解;类型可能包含 ASN.1 文档中未定义
我收到了一份 ASN.1 文档,其中包含两个编码/解码属性; 自动标签 我的理解;标签是使用编码规则自动定义的,除非定义中存在标签符号 隐含的可扩展性 我的理解;类型可能包含 ASN.1 文档中未定义
我的服务器使用 ASN.1 生成的类接收一个 Integer BerInputStream in = new BerInputStream(socket.getInputStream());
我正在尝试在我的 .bashrc 配置文件中使用以下别名: alias ip2asn="IP=$(dig $1 a +short);whois -h v4.whois.cymru.com " -v $
我正在阅读 PKCS #7 ASN.1 定义,并遇到了这种类型。我似乎无法找出 {{Authenticated}} 在此代码中做了什么,或者这将被称为什么产品。我还在 PKCS #8 标准中看到了 {
例如根据 http://luca.ntop.org/Teaching/Appunti/asn1.html一个序列具有十六进制的标记号 10。 但是为什么 DER 编码为 30 而不是 10?带有十六进
我有以下 BERTLV: 61394F0BA00000030800001001234579074F05A000012345500E49442D4F6E65205049562042494F5F50107
为什么模数用前导零填充?我正在阅读 PKCS#1 和 PKCS#8,但没有找到任何相关信息。 在 c# 中必须删除前导零,有人知道为什么吗? 在 http://etherhack.co.uk/asym
我正在尝试使用通信协议(protocol)(具体来说是 S1AP),并且我正在尝试定义要测试的消息。 LTE 36.413 规范详细介绍了该协议(protocol),并在 pdf 的底部给出了 ASN
我正在解码 ASN.1 格式的 X.509 证书。我成功解码了它,遍历了结构,但有一件事我不明白。 在某些情况下,我会得到一个八位字节字符串,而我正在使用的这个网站 ( http://lapo.it/
使用抽象语法表示法声明 IpAddress: IpAddress ::= [APPLICATION 1] INTEGER (0..4294967295) 这段代码中的[APPLICATION 1]是什
我无法理解 ASN.1 的基本概念。 如果类型是 OID,相应的数字是否实际编码在二进制数据中? 例如在此定义中: id-ad-ocsp OBJECT IDENTIFIER ::= {
我需要创建一个包含多条记录的 ASN.1 BER 编码文件。我一直在寻找一个(oss、asn1c、...等工具),但我找不到一个适合我的完整示例,说明如何在一个文件中编码多条记录。 有谁知道一个好工具
使用抽象语法表示法声明 IpAddress: IpAddress ::= [APPLICATION 1] INTEGER (0..4294967295) 这段代码中的[APPLICATION 1]是什
我是一名优秀的程序员,十分优秀!