Hi,
I use your library Itext in a project to sign pdf file.
I try to follow the code example that I saw on your website but I have a
problem.
This is my java code :
try{
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(new FileInputStream("keystore.ks"),
"pdfpassword".toCharArray());
PrivateKey key = (PrivateKey)ks.getKey("pdf",
"pdfpassword".toCharArray());
Certificate[] chain = ks.getCertificateChain(alias);
for (int i = 0; i < pdfFilenames.length; i++) {
PdfReader reader = new PdfReader(pdfFilenames[i]);
//on enleve l'extension du nom de fichier à traiter
afin de modifier le nom
String name = pdfFilenames[i].substring(0,
pdfFilenames[i].lastIndexOf('.'));
FileOutputStream fout = new
FileOutputStream(name+"_signed.pdf");
PdfStamper stp = PdfStamper.createSignature(reader,
fout, '\0');
PdfSignatureAppearance sap =
stp.getSignatureAppearance();
sap.setCrypto(key, chain, null,
PdfSignatureAppearance.SELF_SIGNED);
sap.setCertificationLevel(PdfSignatureAppearance.CERTIFIED_FORM_FILLING);
//comment next line to have an invisible signature
sap.setVisibleSignature(new Rectangle(100, 100, 200,
200), 1, null);
stp.close();
}
}catch(Exception e){
e.printStackTrace();
}
There is no error during the execution.
But I don't see a difference between the first pdf and the pdf signed each time.
In fact, I make different tests.
I use 5 different pdf as input file. At the output only two pdf contain a
signature (although the signature is different in these two cases).
So I don't understand why the signature doesn't work in every case.
If you can help me, it will be great.
Thanks
Best regards,
--
Michaël MARECHAL
DOD - ADSI - Pôle Elfe
( 01.42.97.78.06 / 2.78.06
* 14 - 2118
**************************************************************
Ce mel est a l'attention exclusive des destinataires designes.
Il peut contenir des informations confidentielles.
Si vous le recevez par erreur, merci d'en informer sans delai l'expediteur.
Le contenu de ce mel ne pourrait engager la responsabilite de la Banque de
France
que s'il a ete emis par une personne dument habilitee agissant dans le strict
cadre des fonctions auxquelles elle est employee et a des fins non etrangeres a
ses attributions.
*************************************************************
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/