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

查看:4968
本文介绍了iText / BouncyCastle ClassNotFound org.bouncycastle.asn1.DEREncodable and 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 a>。

According "Getting Started with iText - How to sign a PDF using iText", I have to use the BouncyCastle.

我从 BouncyCastle下载页面。

并添加到项目中:Java Build Path / Libraries /添加外部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.

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

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

推荐答案

BouncyCastle库正在经历重大的API更改,

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


  • 使用旧版本的BouncyCastle库。您可以在此处找到旧版本。但是,您必须找到与此特定版本的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中继线已经固定)。 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.

更多信息可以在此主题中找到

More information can be found in this thread

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

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