简体   繁体   English

数字签名在 Adob​​e 阅读器中不可见,但在福昕阅读器中可见

[英]Digital signature not visible in Adobe reader but visible in Foxit reader

I'm using this library https://github.com/vbuch/node-signpdf to sign a pdf document.我正在使用这个库https://github.com/vbuch/node-signpdf来签署 pdf 文档。 After I have signed the document I can see the signature when I open the pdf with Foxit reader but not when I open it with Adobe reader DC.签署文件后,我可以在使用 Foxit reader 打开 pdf 时看到签名,但在使用 Adob​​e reader DC 打开时看不到。 I also tried Adobe reader XI but there I can't see it either.我也试过 Adob​​e reader XI,但我也看不到它。 When I open the document in pdf xchange viewer I get this error: non critical errors detected in the xref table.当我在 pdf xchange 查看器中打开文档时,出现此错误: non critical errors detected in the xref table.

Any ideas what the problem could be?任何想法可能是什么问题?

That's the file I signed: https://drive.google.com/file/d/1AZvS4sP2Y3FwW4Deod87Dgxc9I0QZkoc/view?usp=sharing这是我签署的文件: https : //drive.google.com/file/d/1AZvS4sP2Y3FwW4Deod87Dgxc9I0QZkoc/view?usp=sharing

In your example PDF the name of the signature field consists of 10 bytes, 9 bytes with value 0x00 and one byte with value 0x01.在您的示例 PDF 中,签名字段的名称由 10 个字节组成,其中 9 个字节的值为 0x00,1 个字节的值为 0x01。 Apparently Adobe Reader does not like that field name.显然 Adob​​e Reader 不喜欢该字段名称。

After some experiments it looks like Adobe Reader does not like a field name starting with a 0x00 byte.经过一些实验,看起来 Adob​​e Reader 不喜欢以 0x00 字节开头的字段名称。

Maybe it contains some code that determines string lengths in a c'ish manner and interprets a 0x00 as end-of-string.也许它包含一些以 c'ish 方式确定字符串长度并将 0x00 解释为字符串结尾的代码。 A field name with a leading 0x00 byte, therefore, is interpreted as empty string, a field name not accepted by Adobe Reader either.因此,具有前导 0x00 字节的字段名称被解释为空字符串,Adobe Reader 也不接受该字段名称。

Thus, please use a signature field name made of (in particular starting with) some meaningful characters.因此,请使用由(特别是以)一些有意义的字符组成的签名字段名称。 As validators usually display the name of the signature field, this is a good idea anyways.由于验证器通常会显示签名字段的名称,因此无论如何这是一个好主意。


In terms of lowlevel PDF objects:就低级 PDF 对象而言:

The signature field object looks like this:签名字段对象如下所示:

18 0 obj
<<
/Type /Annot
/Subtype /Widget
/FT /Sig
/Rect [0 0 0 0]
/V 17 0 R
/T (         )
/F 4
/P 1 0 R
>>
endobj 

but only like this, the string value of the T entry actually contains the above mentioned nine 0x00 bytes and one 0x01 byte.但只有这样,第t项的字符串值实际上包含上述9个0×00字节,一个字节0×01。 This is the value that must be changed to a non-empty string not starting with 0x00.这是必须更改为不以 0x00 开头的非空字符串的值。 I would propose not using bytes < 0x20 at all.我建议根本不使用字节 < 0x20。 Furthermore, the dot, 0x2e, must not be used in the name, it is reserved for separating partial names.此外,名称中不得使用点 0x2e,它保留用于分隔部分名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM