Hi,

I am trying to sign digitally pdf-document. I have made RSA keys with
openssl. I alo made class Signa which reads private key from file and
then signs byte-array (byte[]). Here is code with which I am trying to
sign pdf document:

  // Pdf signature object
  PdfSignature signa = new PdfSignature( "RSA" );
  //name
  signa.setName( "Testi signature ");
  // This add "signature field" into pdf document
  PdfFormField signature = acroForm.addSignature("Allekirjoitus", 73,
705, 149, 759);
  // Here are bytes to be signed
  PdfContentByte cb = writer.getDirectContent();
  // Object that makes signature
  Signa s = new Signa();
  // Into signature object is added signatured bytes.
  signa.setContents( s.sign( cb.toPdf( writer ) ) );
  // signature is added into document
  signature.createSignature( writer );
  signature.setValue(signa);
  writer.addToBody( signature );

It does not work. PDF-reader says that signature is corrupted. Can
someone help and tell me what I am doing wrong? What I should do else
who?

Yours
Sami





-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to