gpt4 book ai didi

java - 使用 Jpedal 呈现包含视觉签名的 PDF 文档

转载 作者:行者123 更新时间:2023-11-30 09:40:20 25 4
gpt4 key购买 nike

我正在使用 Jpedal(LGPL 版本 4.48b55)呈现包含签名的文档页面,并激活视觉表示。但是,这些签名显示时带有一个问号和“签名未验证”文本。

如果我通过 Adob​​e 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 ,则必须为此指定一个特定的提供程序,而不是默认提供程序。

From the documentation :

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com