venerdì 24 febbraio 2012

PDF digital signature example


This tutorial shows how to digitally sign a PDF document using JSignPDF. JSignPDF is a free software which lets you digitally sign PDF documents for free. A digital signature is necessary these days. To have a digital signature over a PDF might be a bit complicated but JSignPDF is a one stop solution for this question.

At first download JSignPDF from sourceforge. Follow the simple installation instructions.
In order to get started we need a pair of private/public keys which are necessary to generate certificates. We will use the Java utility keytool.

D:\keys>keytool -genkey -dname "cn=Tom Jones, ou=JavaSoft, o=Sun, c=US" -alias business -keypass mypass -keystore mykeystore -storepass mypass -validity 180

D:\keys>keytool -export -alias business -keystore mykeystore -keypass mypass -storepass mypass -file MJ.cer

This first command creates the keystore named "mykeystore" in the "working" directory, and assigns it the password "mykeystore". It generates a public/private key pair for the entity whose "distinguished name" has a common name of "Tom Jones", organizational unit of "JavaSoft", organization of "Sun" and two-letter country code of "US".
With the second command, you export the certificate and supply it to your clients. As a result you will obtain a certificate named MJ.cer

Now launch JSign and enter the properties of your keystore into the form fields. The keys generated by keytool utility are of type JKS so select this value as "KeyStore type".
























Click Sign It and verify that the document with signature has been generated successfully:





















Now try to open your document with Acrobat Reader. You will notice that the document bears a signature, however it is not recognized by an authority nor it's included in your trust list.


You can either choose to register your certificate on a trust authority (and pay a few hundreds $$) or you can simply upload your certificate and declare it as trusted.
Choose Document | Manage Trusted Identities and choose "Add contacts":


Select "Browse" and point to your "MJ.cer" certificate that we have formerly created. Once that the contact is loaded, click on "Import" at the bottom of the dialog.

Good. Now your certificate will be enlisted among the other certificates available







We are almost done. Select "Edit trust" option and choose to trust the certificate:

Now restart Adobe and open again the document: the signature is valid and trustworthy!
Using a batch script to sign PDFs:
If you have to sign documents as part of a process, you can use as well the JSignPdf.jar library and add the required parameters. (See JSignPdf documentation for more info about it).
Example:
java -jar JSignPdf.jar -kst JKS -ksf mykeystore -ksp mypass C:/documents/sampledoc.pdf

23 commenti:

  1. I haven't heard of any pdf digital signature till now. This is quite useful information and new to me. Blog is very informative, do keep writing these blogs. I will visit often to read some more latest information.
    pdf digital signature

    RispondiElimina
  2. Thank you for sharing this wonderful information about PDF signing. Adding digital signature to PDF is a good way to protect your PDF file via transmission.

    RispondiElimina
  3. With digital signatures we can legally validate the contract document. In other words, digital signatures have legal strengths and legal consequences as if they were manual signatures. This is a very good article, giving all useful information.

    RispondiElimina
  4. I am very interested with Using a batch script to sign PDFs so helpful for me and your good share article many Thanks

    RispondiElimina
  5. This blog post really help me to understand so many things and it's full of information. We provide Digital Signature Certificate
    at all states of India

    RispondiElimina
  6. Your way to describe this blog is really amazing. Keep writing. It really helps to understand so many things. Thanks. we are the legal provider of Digital Signature certificates

    RispondiElimina
  7. Thanks for the wonderfull blog it's full of knowledge. We are the supreme provider of Digital signature certificate

    RispondiElimina
  8. Awesome content. Your content is very inspiring me and useful for everyone who read this article. I really appreciate what you explain here. Thanks a lot for sharing with us. stiply.nl

    RispondiElimina
  9. The contents present at this web page is very amazing and full of knowledge. keep up the good work.

    Digital Signature provider in Delhi

    RispondiElimina
  10. Thanks for sharing such an awesome post. This is very informative and helpful, share more post like this. Keep it up.

    Auto Digital Signature
    Bulk PDF Signer
    PDF Signer


    RispondiElimina
  11. Thanks for sharing the information. Visit here and get your digital signature online: DSC Class 2

    RispondiElimina

  12. it makes very easy for us to find any site relate to it.



    digital signature certificate

    RispondiElimina
  13. Hey, I liked your blog post, it was indeed amazing! I would like to mention a site selling Best Paperless Digital Signature Certificate In India https://www.acetechnology.co.in/digital-signature-certificates/

    RispondiElimina