Problem when signing PDF hash in PDF readers. Code error 0x2727

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem when signing PDF hash in PDF readers. Code error 0x2727

Diego C
Hi,
I am having trouble digitally signing a pdf hash. This is the implementation and the solution I have found, which is based on Bruno Lewagie's Digital Signatures for PDF Documents. The idea is to sign the PDF hash to avoid taking it to the client.
This is the solution I have come up with:
1. An Applet Java with which I instance a token, get it, and then access it.
2. A servlet java I use to get the hash of the PDF I want to sign. I calculate the hash with the public key I got from the applet. After getting this hash, I send it to the applet (client) to get it signed.

The applet signs the resulting PDF hash and then returns it to the servlet to be inserted in the resulting PDF and saved in a given directory.
At first, it seemed to work out all right, but after completing the process and opening the PDF with any reader, I get the following error: "Internal cryptografic error. Error code: 0x2727".

It is worth mentioning that when I creat a PDF and sign it only with the applet, the signature is correctly validated.

Code:
Applet that interacts with the token and invokes the servlet ->
1

Servlet that after having received the public key of the certificate (sent by the applet) reads a PDF and calculates its hash to return it to the applet.


After signing the PDF the servlet is invoked once again from the applet to insert the signed hash in the resulting PDF -->
3

These are the versions of the libraries I used:
itextpdf -> 5.5.6
bcprov.jdk15on.1.54
jdk1.7



Reply | Threaded
Open this post in threaded view
|

Re: Problem when signing PDF hash in PDF readers. Code error 0x2727

lorretadt
This post has NOT been accepted by the mailing list yet.
c# autocad print to pdf with searchable text can be done on this page http://www.rasteredge.com/how-to/csharp-imaging/pdf-text-search/
mkl
Reply | Threaded
Open this post in threaded view
|

Re: Problem when signing PDF hash in PDF readers. Code error 0x2727

mkl
In reply to this post by Diego C
Diego,
Diego C wrote
I am having trouble digitally signing a pdf hash. This is the implementation and the solution I have found, which is based on Bruno Lewagie's Digital Signatures for PDF Documents. The idea is to sign the PDF hash to avoid taking it to the client.
This is the solution I have come up with:
1. An Applet Java with which I instance a token, get it, and then access it.
2. A servlet java I use to get the hash of the PDF I want to sign. I calculate the hash with the public key I got from the applet. After getting this hash, I send it to the applet (client) to get it signed.

The applet signs the resulting PDF hash and then returns it to the servlet to be inserted in the resulting PDF and saved in a given directory.
At first, it seemed to work out all right, but after completing the process and opening the PDF with any reader, I get the following error: "Internal cryptografic error. Error code: 0x2727".

...
Please

a) provide your code in a way one can copy&paste, not as image. If people want to reproduce your issue to help you, they hardly will have to type it in by hand...

b) provide a sample PDF output on which one can observe and analyze the error.

c) move your question to stackoverflow where meanwhile the public iText support takes place.

Regards,

Michael