Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

[iText-questions] signed and certified not working

Wahaj

2006-11-17


Hi All,

I am trying to certify a PDF which has an empty signature field and a text
field, using the code below, allowing only signing to be done later in the
existing empty signature field but when I opened the certified document in
Acrobat 7, it does not allow me to sign any empty signature field.

Here is the code I am trying:

  System.out.println("Signing and Certifying...");
  PdfReader reader = new PdfReader(m_strInputPDFDocument);
  FileOutputStream fout = new FileOutputStream(a_strOutputPDFDocument);

  // creating the appearance
  PdfStamper stp = PdfStamper.createSignature(reader, fout, '\0', null,
false);
  PdfSignatureAppearance sap = stp.getSignatureAppearance();
  sap.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED);
  sap.setReason("I'm the author");
  sap.setLocation("Lisbon");
  sap.setCertified(true);
  stp.setEncryption(true, "","testing", 256);//encrypt with no open PDF
permissions

When I am only encrypting the PDF, 256 parameter does work correctly works
and I can sign the PDF later on.
I am using iText 1.4.6 with JRE 1.5.

Am I doing some thing wrong here.

Best Regards,
Wahaj


Attachment: smime.p7s
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.