PDF未知签名图标 [英] PDF Unknown signing icon

查看:218
本文介绍了PDF未知签名图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在以编程方式签署PDF.每个新签名都以增量方式添加,在%EOF之后添加签名字典,并像这样更新AcroForm(对不起,我正在工作,所以我无法上传PDF):

I am signing PDF programmatically. Every new signature is added in an incremental way where I add the signature dictionnary after the %EOF and I update the AcroForm like this (sorry, I'm at work so I can't upload the PDF) :

... // ORIGINAL FILE

trailer
<<
/Size 11
/Root 1 0 R
/Info 10 0 R
>>

startxref
2714
%%EOF
1 0 obj 
<</Type /Catalog /Outlines 2 0 R /Pages 3 0 R /AcroForm <</Fields [11 0 R ] /SigFlags 3 >> /Names 14 0 R >>
endobj

...

11 0 obj 
<</Type /Annot /SubType /Widget /Rect [0 0 0 0 ] /P 4 0 R /F 4 /FT /Sig /T (Signature) /Ff 0 /V <</Type /Sig /Filter /Adobe.PPKLite /SubFilter /adbe.pkcs7.detached /ByteRange [0 3729 15473 422                   ] /Contents <308209...> 
/M (D:20170801165520+02'00') >> >>
endobj

...

trailer
<</Size 15 /Root 1 0 R /Info 10 0 R /Prev 2714 >>
startxref
15609
%%EOF
1 0 obj 
<</Type /Catalog /Outlines 2 0 R /Pages 3 0 R /AcroForm <</Fields [15 0 R ] /SigFlags 3 >> /Names 14 0 R >>
endobj

...

15 0 obj 
<</Type /Annot /SubType /Widget /Rect [0 0 0 0 ] /P 4 0 R /F 4 /FT /Sig /T (Signature) /Ff 0 /V <</Type /Sig /Filter /Adobe.PPKLite /SubFilter /adbe.pkcs7.detached /ByteRange [0 16632 28376 387                  ] /Contents <3082062...> 
/M (D:20170802094848+02'00') >> >>
endobj
16 0 obj 

...

<</Size 18 /Root 1 0 R /Info 10 0 R /Prev 15609 >>
startxref
28476
%%EOF

也许问题是我有多个具有相同ID的对象,而我的最后一个AcroForm仅引用了最后一个签名?我希望能够多次签名一个文件,但是有一个问题.第一次签名可以,并显示以下横幅:

Maybe the problem is that I have multiple objects having the same ID and that my last AcroForm only refers to the last signature ? I want to be able to sign one file multiple times but I have an issue. The first signing is okay and displays this banner :

然后我尝试再次使用另一个证书对同一文件进行签名,这给我签名旁边的这个垃圾桶图标,并说它已被删除,正如您在此处看到的那样:

And then I try to sign the same file another time with another certificate and this give me this trash can icon next to the signature and says it was removed as you can see here :

我正在使用Zend_PDF解析文件并添加签名.

I am using Zend_PDF to parse the file and add the signature.

:感谢@mkl,这两个签名现在已被Adobe Reader识别.我的AcroForms现在看起来像这样:

EDIT : Thanks to @mkl the 2 signatures are now recognized by Adobe Reader. My AcroForms now look like this :

2714
%%EOF
1 0 obj 
<</Type /Catalog /Outlines 2 0 R /Pages 3 0 R /AcroForm <</Fields [11 0 R ] /SigFlags 3 >> /Names 14 0 R >>
endobj

... 

15610
%%EOF
1 0 obj 
<</Type /Catalog /Outlines 2 0 R /Pages 3 0 R /AcroForm <</Fields [11 0 R 15 0 R ] /SigFlags 3 >> /Names 14 0 R >>
endobj

...

我有这个令人惊讶的错误,因为我没有修改ByteRange的任何内容,并且我手动验证了它们的正确性.是关于我的新修改的吗?

And I have this surprising errors since I didn't modify anything about the ByteRange and I verified by hand that they are correct. Is is about my new modifications ?

推荐答案

添加第一个签名时,将 AcroForm 字典设置为

While adding the first signature you set the AcroForm dictionary to

/AcroForm <</Fields [11 0 R ] /SigFlags 3 >> 

对于第二个,您将其设置为

For the second one, you set it to

/AcroForm <</Fields [15 0 R ] /SigFlags 3 >>

即您从其中删除了11 0 R并向其中添加了15 0 R.因此,您确实从表单结构中删除了第一个签名字段.

I.e. you removed 11 0 R from it and added 15 0 R to it. Thus, you indeed deleted the first signature field from the form structure.

您应该只添加新的签名字段:

You should instead only have added the new signature field:

/AcroForm <</Fields [11 0 R 15 0 R ] /SigFlags 3 >>

此外,您的两个签名字段都具有相同的名称

Furthermore, both your signature fields have the same name

11 0 obj 
<<
    ...
    /T (Signature) 
    ...
>>
endobj
...
15 0 obj 
<<
    ...
    /T (Signature)
    ...
>>
endobj

显然,不同的表单字段必须具有不同的名称.

Obviously, different form fields must have different names.

这篇关于PDF未知签名图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆