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

Signature not valid, error on format or information within the signature #57

Open
Nujuron opened this issue Jul 21, 2023 · 4 comments
Open

Comments

@Nujuron
Copy link

Nujuron commented Jul 21, 2023

Hello, I've been trying to digitally sign PDFs generated with the mPDF library , I can successfully generate the PDF and sign it with the pdfsign.php example, but when I check the document with different programs (one of them being Adove Reader) I get a "Signature not valid, Contents illegal data". I've checked the signature itself, using a program to sign a document with it and works correctly.

Not signed PDF
Example of signed PDF

Thanks in advance.

@Lucas-mendes19
Copy link

I also have this problem.

@KJ2ME
Copy link

KJ2ME commented Aug 2, 2023

I think that the problem is a bad generated .p12 file.

Try again generating the file with openssl:

openssl genrsa -out private.pem 2048
openssl req -new -sha256 -key private.pem -out csr.csr
openssl req -x509 -sha256 -days 365 -key private.pem -in csr.csr -out certificate.pem
openssl pkcs12 -export -out identity.p12 -inkey private.pem -in certificate.pem

Then use the file "identity.p12" for sign the PDF.

@Lucas-mendes19
Copy link

I believe that the problem is not the certificate, because I use a certificate generated by an official issuer and this problem still happens, and I already used this certificate and it worked, but from some moment until now this problem has been happening.

@felixble
Copy link

I had a similar issue which could be solved with these changes: #61.

My certificate was also generated by an official issuer which came with a root and an intermediate certificate. Unfortunately, the intermediate certificate is currently not supported by this library (which will be changed by the PR #61). This results in not trusting the signed pdf because the trust chain can only be made via the intermediate certificate.

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

4 participants