Thx for the answer. I have included the Bouncy Castle Jars
(bcprov-jdk14-146.jar and bcmail-jdk14-146.jar) into the classpath and the
application doenst throw an exception at all. If it would, the return
parameter wouldnt be filled, but it is. The pdf-data i am throwing to the
web service gets returned and can be displayed. Just the pwd is not set at
all! :(

/public byte[] encrypt(byte[] pdf, byte[] pwd) {
                // TODO : Implement
                
                try {
                        PdfReader reader = new PdfReader(pdf);
                        ByteArrayOutputStream boas = new 
ByteArrayOutputStream();
                        try {
                                PdfStamper stamper = new PdfStamper(reader, 
boas);                      
                                stamper.setEncryption(pwd, pwd,
                                                PdfWriter.ALLOW_PRINTING, 
PdfWriter.ENCRYPTION_AES_128 |
PdfWriter.DO_NOT_ENCRYPT_METADATA);
                                stamper.close();
                                *return boas.toByteArray();*
                        } catch (DocumentException e) {
                                e.printStackTrace();
                        }                               
                } catch (IOException e) {
                        e.printStackTrace();
                }               
                
                
                return null;
        }/

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/PDF-encryption-as-a-Web-Service-on-a-JDK-1-4-based-Application-Server-tp3677768p3677811.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to