c# - 当签名对 iTextSharp 有效时如何显示 "✔"?

标签 c# itext pdfstamper

当受信任的证书时,我需要像这样在 pdf 中签名:

Signature in PDF

当证书来源不明时显示“?”。

我可以做签名,但不显示“✔”或“?”。

最佳答案

请参阅 PAdES 第 6 部分(又名 ETSI TS 102 778-6),更具体地说是标题为“AdES 签名验证的可视化表示” 的第 6 部分。

我引用:

A conforming signature handler shall not display the result of the signature validation inside the page content.

NOTE: The conforming signature handler will use off-page display to present the verification result.

如果您正在寻求一种使用 iText(Sharp) 为 PDF 文件中签名的可视化表示添加绿色复选标记的方法,那么您正在寻求实现违反 PAdES-6 的东西,并且将违反 ISO-32000-2。

我可以访问 ISO-32000-2 第 12.8 节的草案(我对其进行了编辑),这就是它的内容:

the information included in the appearance dictionary shall not be used by a signature verification handler at the time of signature verification. It is there strictly for the purpose of providing a way for a human verifier to perform their own verification of the visual representation. A PDF processor shall not incorporate the validation status of a signature (e.g. a checkmark for passed or an X for failed) into the appearance of the signature field.

换句话说:你的问题是错误的。根据 PDF 规范,您正在询问一种生成无效 PDF 的方法。

绿色复选标记、红色十字、黄色矩形...这些都是关于签名状态(有效、无效、未知)的视觉指示,使用的应用程序应该使用它们/em> 已签名的 PDF(例如 PDF 查看器)。您正在寻求一种通过应用程序添加此类符号的方法,该应用程序生成 已签名的 PDF,这是 PDF 规范所禁止的。

您应该问的问题是:“对于具有有效签名的已签名 PDF,我什么时候会在 PDF 查看器中看到绿色复选标记?”

  • 如果您使用的是来自 Adob​​e CDS(已停产)或 ATTL(CDS 的后继者)计划的合作伙伴的证书,则此绿色复选标记将自动出现在 Adob​​e Reader 中。其他规则可能适用于其他观众。
  • 如果您使用的证书来自 CA,而该 CA 并未向 Adob​​e 支付费用以使其根证书包含在受信任的根证书集合中,那么您应该自行将 CA 的根证书添加到 PDF 查看器的受信任身份中.这可以手动完成,但也有自动完成的方法。

阅读http://itextpdf.com/book/digitalsignatures了解更多信息。

关于c# - 当签名对 iTextSharp 有效时如何显示 "✔"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30184506/

相关文章:

c# - 这个指令是什么意思?

c# - 检查整数是否为 0 并返回 bool 值的简短方法

c# - 从 List<T> 保存到 txt

java - com.itextpdf.text.exceptions.IllegalPdfSyntaxException : Unbalanced begin/end text operators

iTextSharp - 将新文档创建为 Byte[]

itext - 使用 libre office 创建的 Acrofield 不可填写代码,除非我编辑 pdf 一次

c# - 针对 10240 的 UWP 应用中的辅助 View 中未调用卸载事件

java - iText:如何在新页面上重复表格单元格内容?

itext - 导入 PDF 位置 PDFStamper

java - iText - 读取复选框值