What's the stack trace?

----- Original Message ----- From: "Cédric Malderez" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, March 01, 2006 9:51 AM
Subject: [iText-questions] Signed PDF using smartcard or usb key tokens


Hi,

I manage to sign a PDF document using a PKCS#12 containing Signer
Certificate & Private Key
Now I'm trying to perform the same operation using a crypto token such
SafeNet iKey usb key, through it's PKCS#11 API.
I'm using iaik JCE & PKCS#11 Provider (and wrapper)

I've tried setting up the IAIKPkcs11 Provider to the
PdfSignatureAppearance object .. but It keep crashing with a
NullPointerException when closing the PdfStamper object.

Here is the code:

   System.out.println("Ouverture du PDF source");
  PdfReader     reader = new PdfReader(args[0]);
  FileOutputStream   fout = new FileOutputStream(args[1]);
  PdfStamper     stp = PdfStamper.createSignature(reader, fout, '\0');
  PdfSignatureAppearance  sap = stp.getSignatureAppearance();

  sap.setProvider("iaik.pkcs.pkcs11.provider.IAIKPkcs11");
  sap.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED);
  sap.setReason("I'm the author");
  sap.setLocation("Paris");
  sap.setVisibleSignature(new Rectangle(100, 10, 200, 200), 1, null);
  stp.close();


The key (PrivateKey) & chain (X509Certificate) are obtained from the
PKCS#11 Provider while looking at cert & priv key from the token.

Anybody already tried to sign PDF doc like that ?

Thanks :)




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to