KeyStore ks = KeyStore.getInstance("pkcs12");
        ks.load(new FileInputStream("JohnSmith.pfx"),
"azerty".toCharArray());
        String alias = (String) ks.aliases().nextElement();
        PrivateKey key = (PrivateKey) ks.getKey(alias,
"azerty".toCharArray());
        Certificate[] chain = ks.getCertificateChain(alias);
        fout = new FileOutputStream("signednEncrypted.pdf");
        reader = new PdfReader("guide.pdf");
        PdfStamper stp = PdfStamper.createSignature(reader, fout, '\0');
        stp.setEncryption(...); // ********** Changed ***********
        PdfSignatureAppearance sap = stp.getSignatureAppearance();
        sap.setCrypto(key, chain, null,
PdfSignatureAppearance.WINCER_SIGNED);
        sap.setReason("I'm the author");
        sap.setLocation("Lisbon");
        stp.close(); 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of John Smith
> Sent: Thursday, November 17, 2005 4:28 PM
> To: [email protected]
> Subject: [iText-questions] Re: Encrypt and Sign
> 
> Thank you Paulo for your answer, but I don't get how you can 
> do that with the
> iText API, especially the "encrypt and sign at the same time" 
> way. Could you
> help me a little bite more please.
> 
> Thanking you in advance.
> 
> John
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
> Register for a JBoss Training Course.  Free Certification Exam
> for All Training Attendees Through End of 2005. For more info visit:
> http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to