我正在使用 Jpedal(LGPL 版本 4.48b55)来渲染包含已激活视觉表示的签名的文档页面。然而,这些签名带有一个过度的问号和文本“签名未验证”。
如果我通过 Adobe Acrobat Reader 可视化该文件,我会看到一个绿色勾号和一条文字,说明“签名有效”(因为我在列表中包含了签名的证书颁发机构)。
有没有办法强制 jPedal 使用有效证书颁发机构列表来验证签名,从而使签名有效?
最佳答案
为了在 Java 中使用证书,您需要首先将其安装在 Java keystore 上。使用工具keytool提供Java运行时来完成此任务。
来自页面“The Most Common Java Keytool Keystore Commands”:
# Import New CA into Trusted Certs
keytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts
如果您希望应用程序直接使用操作系统中的 keystore ,则必须为此指定一个与默认提供程序不同的特定提供程序。
Keystore implementations are provider-based. More specifically, the application interfaces supplied by KeyStore are implemented in terms of a "Service Provider Interface" (SPI). That is, there is a corresponding abstract KeystoreSpi class, also in the java.security package, which defines the SPI methods that "providers" must implement.
还有:
There is a built-in default implementation, provided by Sun Microsystems. It implements the keystore as a file, utilizing a proprietary keystore type (format) named "JKS".
关于java - 使用 Jpedal 渲染包含视觉签名的 PDF 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9464973/