如何将 VRI 词典添加到 PDF 中

How to add VRI dictonary into a PDF

有! 我正在使用 pdfbox 1.8.11 进行 pdf 签名,我可以创建一个嵌入了 DSS 字典的支持 LTV 的签名。现在的问题是多签名时的证书校验问题

根据PDF 2.0 LTV和PAdES LTV规范,允许为每个签名添加VRI,这样就可以为每个特定的签名验证相关的撤销数据。

知道如何为签名添加 VRI 词典吗?由于 VRI 的密钥是 base-16 编码的哈希,这意味着我需要先有签名。据我所知(我希望我错了),签名是在将带有签名相关信息的 PDF 保存到输出流中时创建的。 (PDDocument.saveIncremental(ins, outs))

=========================================== ===============

更详细:

当我想根据 PAdES LTV 和 PDF 2.0 LTV 规范验证针对 DSS 数据的签名时,我 运行 遇到了这个问题。首先关注的是 PDF 2.0 LTV 规范。

如果我理解正确的话:

  1. DSS 包含我们在已签名 PDF 中的所有签名的撤销数据。

情况我运行变成: 假设:有两个用户User A和User B,他们的证书是由同一个CA:s签发的。 (我认为这很常见。)

  1. 用户 A 使用 DSS 签署了文档(certs/crls/ocps 已嵌入)。
  2. 几天后,用户 B 使用 DSS (certs/crls/ocps) 签署了用户 A 签署的文档。 注意!:crls 由发行者标识符标识。

签名验证阶段:

当我想重建证书链时,根据 crls 和 ocsps 验证签名证书,特别是当我想检查 crl 在文档签名时没有过期时,我需要确保我我正在使用正确版本的 crl。

对我来说,这意味着我应该检查 certs/crls/ocsps 是否正确映射到签名。否则验证再靠谱,同样没有意义。

因此,即使最新的PAdES规范103也不推荐使用VRI。说真的,我觉得不对....

然后是另一个问题:

正如我在下面评论的那样,我正在使用 pdfbox 来签署 pdf。

  1. 如果我事先收集 DSS 数据,然后创建签名。 (事实是DSS也是签名内容的一部分。)

    • 好东西:acrobat reader 识别出我的签名启用了 LTV。
    • 坏事:在这种情况下,我无法在那里添加 VRI。 VRI 的密钥是签名的哈希值。
  2. 如果我先对文档进行签名,然后使用 VRI 获得签名和 DSS,acrobat reader 将不再识别 DSS。我的签名不再为 acrobat reader 启用 LTV。 这是我困惑的问题。 acrobat reader LTV验证错误还是??

我觉得错了吗?如果我理解有误,请指出。 提前致谢!

首先,我浏览过的最新 PDF 2.0 草稿已经有两年了。因此,我的回答最好基于 ETSI 标准而不是该草案。 ;)

If i understand correctly:

  1. The DSS contains revocation data for all signatures we have in the signed PDF.

不一定是所有个签名。如果验证者只对单个签名的有效性感兴趣(如果文档中的签名具有不同的语义,则可能出现这种情况),它仍然应该添加获取的验证相关信息。

When I want to rebuild the certificates chain, verify the sign certificate against the crls and ocsps, especially when I want to check the crl is not expired at the time when the document is signed, I need to make sure I'm using the right version of crl.

To me, it means I should check certs/crls/ocsps correctly mapped with the signature. Otherwise the verification is reliable any more, equally meaningless.

你的目标是什么?您是否尝试重新制定特定的先前验证行为?或者您只是想验证签名?

在前一种情况下,您确实需要一些映射 "for verifying this signature the following validation relation information was used",例如VRI 结构。

不过,通常后者是您的任务,在这种情况下,您可以使用找到的任何与验证相关的信息,只要它适用。因此,在同一 CA 颁发的签名者证书的样本情况下,只要 CRL 有效期间隔对于签名的验证时间和 CRL 本身的签名都可以得到肯定验证,就可以使用相同的 CRL。

因此,

Therefore, even though the latest PAdES specification 103 does not recommend to use VRI. Seriously, I think it is not right....

LTV上的PAdES规范只是想保证签名可以被验证,而不是像以前一样被验证。有了这个任务,就对了。

If I collect DSS data beforehand, create the signature afterwards. (The fact is that the DSS is also part of the signed content.)

Good thing: acrobat reader recognize my signature is LTV enabled.

Bad thing: in such situation, I'm not able to add VRI there. The key for VRI is hashed value of the signature.

你不仅不行,你还不行!正如 ETSI EN 319 142-1 V1.1.1 所说:

Any VRI dictionaries shall be located in document incremental update sections. If the Signature Dictionary to which a VRI dictionary applies is itself in an incremental update section (see clause 7.5.6 of ISO 32000-1 [1]), the VRI update shall be done later than the signature update.

If I sign the document first, got the signature and DSS with VRI afterwards, acrobat reader does not recognize the DSS any more. My signature is no longer LTV enabled to acrobat reader. It is the problem I'm confused. Is acrobat reader wrong in LTV verification or ??

这是显示此行为的示例文件可以提供帮助的地方