qpdf encryption of a pdf file
Is there a way to encrypt a pdf with 128AES using only preinstalled ubuntu software of software from main repository? I noticed that exproting from libre office into pdf (one possibility) encrypts it whith a week encryption. Is there a way to to it e.g. using qpdf?
After installing qpdf, you can encrypt pdf with password of your choice from command line in the following way.
qpdf --encrypt test123 test123 40 -- doc_without_pass.pdf doc_with_pass.pdf
Where test123 is both the user and owner password
To decrypt the pdf file you can use the following
qpdf --password=test123 --decrypt doc_with_pass.pdf doc_without_pass2.pdf
QPDF is capable of encrypting a file with 256-bit encryption keys and AES (or the default RC4 with 40, 128 or 256 bit key lengths). The relevant information and command line options are in the QPDF manual.