just now i recognized, that i can only decrypt the encrypted pdf-file without password, if i use PdfWriter.STRENGTH128BITS during encryption. --> PdfReader reader = new PdfReader(pdfEncrypted.pdf);
If i use PdfWriter.STRENGTH40BITS, i need the user-password --> PdfReader reader = new PdfReader(pdfEncrypted.pdf, "userPW".getBytes()); But i hope, it is not the solution, just to set the encryption to 40 bit... -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Paulo Soares Gesendet: Montag, 17. Juli 2006 13:53 An: Post all your questions about iText here Betreff: Re: [iText-questions] Reading encrypted PDF-files without user-password If you have a user password it will certainly need the password to open it. What's the behaviour in Acrobat when opening the doc? Paulo > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of stefan humbold > Sent: Monday, July 17, 2006 12:02 PM > To: [email protected] > Subject: [iText-questions] Reading encrypted PDF-files > without user-password > > Hello iTexter, > > i want to make encrypted PDF-files with iText (iText > v1.4.2, JDK 1.5.0): > > ... > PdfWriter writer = PdfWriter.getInstance(document, new > FileOutputStream(pdfEncrypted.pdf)); > writer.setEncryption(PdfWriter.STRENGTH128BITS, > "userPW", "ownerPW", permissions); > ... > > My user password in this example is "userPW". > > I thougt, that this encryption is secure and that i > need the user-password to read the encrypted pdf-File. > > But now i can open the generated file with iText > without user password.... the user password is simple > null! > > ... > PdfReader reader = new PdfReader(pdfEncrypted.pdf); > PdfEncryptor.encrypt(reader, new FileOutputStream(pdfDecrypted.pdf), > null, null, PdfWriter.AllowPrinting, false); > ... > > Now i can save the decrypted file without encryption. > > Even if i take the encrypted pdf-file from the iText -Tutorial, i > don't need a password to open the file with iText... my password is > again null. > (http://itextdocs.lowagie.com/tutorial/general/HelloEncrypted.pdf) > I don't know, if this is a bug or a feature? > > But if i take the encrypted pdf-file from itextsharp > (http://itextsharp.sourceforge.net/examples/Chap0110.pdf) > , i get --> java.io.IOException: Bad user password > This pdf-file seems to be encrypted correct. > > Seems, that the PDF-Files encrypted by java-iText can > always be deyrypted by java-iText. Independent of the > giffen password during encryption. > Did i make any mistake(s) during encryption? > > Hope for help! > Humbi > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > > -------------------------------------------------------------- > ----------- > Using Tomcat but need to do more? Need to support web > services, security? > Get stuff done quickly with pre-integrated technology to make > your job easier > Download IBM WebSphere Application Server v.1.0.1 based on > Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057& > dat=121642 > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message. ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
