-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signing PDF with annotations results in invalid signature #50
Comments
Can you add some examples code and the resulting PDF files? |
@vanbroup Sure: Working PDF
PDF download: working.pdf Failing PDF
The only difference is that this PDF contains a Link annotation PDF download: failing.pdf ReproI am using this code for signing the PDF: pdfSign.Sign(bytes.NewReader(pdf), pdfWriter, pdfReader, pdfLen, pdfSign.SignData{
Signature: pdfSign.SignDataSignature{
CertType: pdfSign.CertificationSignature,
DocMDPPerm: pdfSign.AllowFillingExistingFormFieldsAndSignaturesAndCRUDAnnotationsPerms,
Info: pdfSign.SignDataSignatureInfo{
Name: "Test Signing",
Reason: "Demonstrating signing failures",
Location: "The Internet",
ContactInfo: "Twometer",
Date: time.Now(),
},
},
DigestAlgorithm: crypto.SHA384,
Signer: certs.key,
Certificate: certs.cert,
CertificateChains: [][]*x509.Certificate{certs.chain},
}) Here is the full repro code: https://gist.github.com/Twometer/d6611dee04132251531fbc2962190388 More infoThe only difference I can see in those PDFs raw streams is the line
being present in the Page object. (And of course some changes to the signature and the xref table) |
Thanks for these details @Twometer. I couldn’t find your unsigned file right away, but I’ve just released a new version that should address your issue. Could you please verify if it works? |
Thanks @vanbroup, I have just tested the new version ( Do I have to change any settings in the signing configuration? The unsigned file is created dynamically in the repro code with gopdf, but i've also attached it here: failing-unsigned.pdf |
This doesn't happen with any of the test documents right? I have not been able to look at your source document yet but have you tried opening that with Acrobat and does it ask you to have the document when closing (this often happens when there is an issue in the source document). Also, do you know if the document has an xref table or stream? I did do most testing with the tables and less with the streams for now. |
I've tried I've also tried opening and closing multiple source files in Adobe, and never got a saving prompt. My source document has just a regular xref table at the end of the document, no xref streams. |
The only difference I can see between the test document and my document is that the |
I have a PDF that was created with gopdf and contains Link annotations.
The PDF is then signed with pdfsign.
If I open the signed document in Adobe, it reports:
Without the link annotation, everything works fine and the PDF is shown as certified.
The text was updated successfully, but these errors were encountered: