iText / BouncyCastle ClassNotFound org.bouncycastle.asn1.DEREncodable和org.bouncycastle.tsp.TimeStampTokenInfo [英] iText/BouncyCastle ClassNotFound org.bouncycastle.asn1.DEREncodable and org.bouncycastle.tsp.TimeStampTokenInfo

查看:1442
本文介绍了iText / BouncyCastle ClassNotFound org.bouncycastle.asn1.DEREncodable和org.bouncycastle.tsp.TimeStampTokenInfo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 iText Java。
运行示例如何签名时会出现以下错误:

I'm trying to use iText Java. When you run the example "how to sign" the following error occurs:

Caused by: java.lang.ClassNotFoundException: org.bouncycastle.tsp.TimeStampTokenInfo

根据iText入门 - 如何使用iText签署PDF,我必须使用 BouncyCastle

我下载了文件:bcprov-jdk15on-147.jar from BouncyCastle下载页面

并添加到项目中:Java Build Path / Libraries / Add外部JAR ...

I downloaded the file: bcprov-jdk15on-147.jar from BouncyCastle download page.
And added to the project: Java Build Path/Libraries/Add External JARs...

我添加了以下行:

Security.addProvider(new BouncyCastleProvider());

当您运行示例时发生相同的错误。

所以我下载另一个文件:bcpkix-jdk15on-147.jar,标题为PKIX / CMS / EAC / PKCS / OCSP / TSP / OPENSSL,
并添加到项目中:Java构建路径/库/添加外部JAR。 .. $
现在我有两个Jars。

When you run the example the same error occurs.
So I downloaded another file: bcpkix-jdk15on-147.jar entitled "PKIX/CMS/EAC/PKCS/OCSP/TSP/OPENSSL"
And added to the project: Java Build Path/Libraries/Add External JARs...
Now I have two Jars.

当您运行示例时,出现以下错误:

When you run the example the following error occurs:

Caused by: java.lang.ClassNotFoundException: org.bouncycastle.asn1.DEREncodable

我尝试下载文件bcprov-ext-jdk15on-147.jar,但没有解决问题。

I tried downloading the file "bcprov-ext-jdk15on-147.jar" but did not solve the problem.

我是在Windows 7 64位上使用iText 5.2.1和eclipse。

I am using iText 5.2.1 and eclipse on Windows 7 64 bits.

推荐答案

BouncyCastle库正在经历严重的API更改,从而破坏了与其他图书如iText。

BouncyCastle libs are undergoing heavy API changes that broke the compatibility with other libs like iText.


  • 使用以前的版本的BouncyCastle库。旧版本可以在 here 找到。但是,您必须找到与此特定版本的BC兼容的iText版本。

  • use a previous version of BouncyCastle libs. Old versions can be found here. However, you'll have to find the right version of iText that was compatible with this particular version of BC.

使您自己构建的iText(SVN主干已经固定)。 iText可以使用Maven构建(有一个简短的自述文件在SVN的根目录)。请注意,这是由您自己承担风险,可能在主干中有错误。

make your own build of iText (the SVN trunk has been fixed). iText can be build with Maven (there's a short readme file at the root of the SVN). Please note that it's at your own risk, there may be bugs in trunk.

等待下一个版本的iText。从我的经验来看,iText的发布每隔几个月,有时更经常,有时更少。我不是iText提交者,所以我不能给你任何ETA。

wait for the next version of iText. From my experience, iText releases come every couple of months, sometime more often, sometimes less. I'm not an iText committer though, so I can't give you any ETA.

更多信息可以发现在这个主题

这篇关于iText / BouncyCastle ClassNotFound org.bouncycastle.asn1.DEREncodable和org.bouncycastle.tsp.TimeStampTokenInfo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆