• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1626
  • Last Modified:

iText encryption doesn't allow normal opening

Hi

I use iText to modify PDF files, encrypt them to block printing, modifying or copying text from it. I can do that with Acrobat Professional, but I want to do that with iText.

iText does it but it also protects entire file and doesn't allow OPENING file normally, I tried everything but again it encrypt the file and do not let opening file.

Please advice, I want to disable printing, modifying etc. but I don't want to disable opening...


Here is how I call iText
java -cp itext.jar;bcprov.jar com.lowagie.tools.EncryptPdf output2.pdf encrypted_output.pdf user master 00000000 128

Please advice.
Thanks from now!
0
CSecurity
Asked:
CSecurity
  • 4
  • 2
1 Solution
 
Karl Heinz KremerCommented:
Try to provide an empty user password (e.g. in your example, instead of user, just put "" on your command line). Does that change how the file can be opened?
0
 
mbodewesCommented:
Just as a hint: Don't forget that your settings can be safely ignored by anyone not wanting to adhere to them. There are literally tens of shareware programs that remove this protection from PDF files again. So it is only useful as a warning to users\ (and irritate the hell out of them). Actually, the same iText can be used to remove the protection again.
0
 
Karl Heinz KremerCommented:
As far as I know, you can only remove protection with iText if you know the master password - it's not a tool to crack the PDF files.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
mbodewesCommented:
Absolutely, you need some cracking tool (and a weak passport) to pull that off, however the author was just trying to protect against printing, modifying and copying, which are really just settings for the Adobe reader (and compliant readers I suppose), not much else. Anyway, it was not a solution, just a general piece of information.
0
 
CSecurityAuthor Commented:
Hey, I tried null password, but not worked... I don't care about crackers or anyone want to remove my protection, just I want my PDF have protection and don't need password for opening
0
 
Karl Heinz KremerCommented:
What happens when you use a null password? According to the iText documentation, that should work. Have you thought about creating your own Java program (or to modify the one that comes with the toolbox)?
0
 
Karl Heinz KremerCommented:
And, if you just want to assign security, without messing around with Java, or with your own program, take a look at PdfTk (http://www.accesspdf.com/pdftk/), which is based on iText. It's a command line program that's available compiled for different architectures, but you can also get the source code and compile it yourself.

It does allow to set a user password independently from the owner password.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now