Vitor Pereira

RSS Feeds

BlogSphere LotusGeek Custom Button Custom Button

« Blue Wave Technology + BE Systems = Great news | Main| gDominoMail »

SnTT: Signing and certifying PDFs with iText

Bookmark : del.icio.us  Technorati  Digg This  Add To Furl  Add To YahooMyWeb  Add To Reddit  Add To NewsVine 

I recently had the need to digitally sign and certify existing PDFs attached to documents in a Notes db. Having heard of iText for the first time on Matt's blog I decided to investigate it a little further. Turns out iText is an OpenSource Java library that allows generation and complete manipulation of PDF documents. It was developed by Bruno Lowagie and Paulo Soares, it has been around for quite a while now and is under active and continuous development.

I don't need to generate the PDF as I already have it but iText also provides signature and certification functionality which is just what I need, you can read how to do this here. Paulo explains and provides some examples on how to do it and it is pretty simple. For those of you not familiar with this: signing applies a digital signature to the PDF document and you need either to get a certificate from a trusted authority or use a self signed certificate; certifying ensures that any change to the document that goes against the certification level will make it lose the certified status and the signature will display just that.

One thing you have to remember is iText requires jdk1.4, think ND7. There are also SVN repositories of the source code for jdk1.3 and 1.5 which you can download and compile yourself. So if you're stuck in R6 land, like me, you have to download the source for jdk1.3 and compile it.

One problem I had while testing in the Notes client was that in order to work with strong encryption I had to download the unrestricted JCE policy files for the IBM Java SDK, you can get it here, follow the link to the appropriate version and look for the policy files link. It's a zip download with 2 files in it which you have to drop on your jre/lib/security/ folder (please do keep a backup copy on the current files before replacing). I only had to this for Notes not Domino.

Some useful resources:
iText Homepage
How to sign a PDF using iText and iTextSharp by Paulo Soares
SVN repositories
IBM JDKs