I've recently upgraded our server from CentOS 6 to CentOS 7 and I am having issues getting pdf encryption working on it.

On CentOS 6 I installed libgcj and then the pdftk package. I could then encrypt pdfs using

/usr/sbin/pdftk pdfName.pdf output pdfEncrypted.pdf owner_pw 123 user_pe 123

I know I cannot install pdftk on CentOS 7 because it does not support libgcj but is there an alternate way to achieve what I need?


First Alternative: use qpdf. It's on CentOS 7 base system.

# yum install qpdf
$ qpdf --encrypt user-password owner-password 40 -- file1.pdf file2.pdf

This will take file1.pdf as input, assign user and owner passwords, a key length of 40(valid values are 40, 128, or 256) and export the encrypted data to file2.pdf

To "unlock" pdf files:

$ qpdf --decrypt --password=password locked.pdf unlocked.pdf

You can find here more qpdf encrypt options

Second Alternative: There is the possibility to use any general purpouse file encryption tool. You can find a well explained document about some of them here.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.