Skip to content
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

'sigandcertify': True results in invalid signature #68

Closed
Wason1797 opened this issue Oct 1, 2020 · 9 comments
Closed

'sigandcertify': True results in invalid signature #68

Wason1797 opened this issue Oct 1, 2020 · 9 comments

Comments

@Wason1797
Copy link

Hi, I was having some problems with cms.sign. I tried running the example with my own cert file which resulted in an invalid signature due to changes to the document.

image

but if I set sigandcertify to False then the signature is perfectly fine:

image

Is there something I am doing wrong?
Or I am not understainding the usage of sigandcertify ?

Thanks a lot

@m32
Copy link
Owner

m32 commented Oct 2, 2020

The document can be certified or only signed, sigandcertify enables document certification. From what I read in the documentation, a pdf document can only be certified once and signed multiple times. Maybe there is some nuance I don't know about. Send me the pdf document you want to certify, I will look for the reason for the error.

@Wason1797
Copy link
Author

Wason1797 commented Oct 2, 2020

Thanks for the reply.

The issue appears with any pdf I've tried. In the case of the example was a blank pdf created with Nitro pro 10.
It also appears when I try with examples/demo2_user1.p12 so I don't think it is the certificate.

In any case here is the file.
Untitled1.pdf

and the parameters I used

dct = { "aligned": 0, "sigflags": 3, "sigflagsft": 132, "sigpage": 0, "sigbutton": True, "sigfield": "Signature1", "sigandcertify": True, "signaturebox": (470, 840, 570, 640), "signature": "Wason1797", "signature_img": "examples/logo.png", "contact": "wbrborich@gmail.com", "location": "lol", "signingdate": date, "reason": "testing", }

The error in particular states that some changes have been made to the document after signing, could it be that the process is adding data afterward with sigandcertify?

@m32
Copy link
Owner

m32 commented Oct 3, 2020

My experience with acrobat reader shows that an invalid file after signing generates strange problems in this program.

Untitled1.pdf is not valid, error (s):
8.1: A Mandatory element is missing, Unable to process an element if it is null.
7.2: Error on MetaData, CreatorTool present in the document catalog dictionary can't be found in XMP information (Property is not defined)
7.11: Error on MetaData, PDF / A identification schema http://www.aiim.org/pdfa/ns/id/ is missing

@m32
Copy link
Owner

m32 commented Oct 3, 2020

pdf-sign-cms.py has created the file and my acrobat reader is reading it without problems
Untitled1-signed-cms.pdf

@Wason1797
Copy link
Author

I have checked your file and it gives me the same error with Nitro pro 10.

image

Could be that Nitro is the main culprit?

@m32
Copy link
Owner

m32 commented Oct 3, 2020

Maybe it (nitro) is just not able to check the certificate and therefore gives error messages - unfortunately I don't understand them, are they in Spanish? Can you translate them?

@m32
Copy link
Owner

m32 commented Oct 4, 2020

The same document but signed by certificate issued by actalis
Untitled1-signed-cms-m32.pdf
for pdf verification use https://ec.europa.eu/cefdigital/DSS/webapp-demo/validation

@Wason1797
Copy link
Author

In this case Nitro reports signature validity is unknown this document has not been changed since it was signed or it has changes that were allowed by a previous signee

image

Maybe is just a quirk of the program

The previous errors where: the revision of this document covered by the signature is unchanged, but there where changes made to the document afterwards

@m32
Copy link
Owner

m32 commented Oct 5, 2020

Both documents signed with the same program but with different certificates, and one is marked as a modified document, and the other only unknown signature value?
For me it is definitely not an endesive problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants