PdfCrypt is a windows 32 console/command line version PDF encrypt & decrypt software, supports standard 48 bits, 128 bits, AES-128 bits encryption, and decryption. And first of all,it is free.
If you need java source code, linux stand alone version, or .net version, please let me know.
It bases on modified version iText 1.5.4 and gcj 3.4.2, compressed with UPX 3.03.
Here is the usage manual,
permissions is 8 digit long 0 or 1. Each digit has a particular security function:
AllowFillIn (128 bit only)
AllowScreenReaders (128 bit only)
AllowAssembly (128 bit only)
AllowDegradedPrinting (128 bit only)
Example permissions to copy and print would be: 10100000
pdfcrypt encrypt in.pdf out.pdf owner_pwd user_pwd 10100000 AES
pdfcrypt encrypt in.pdf out.pdf owner_pwd “” 11100000 128 //128 bits encrypt with owner password
pdfcrypt encrypt in.pdf out.pdf “” user_pwd 11100000 128 //18 bits encrypt with user password
pdfcrypt decrypt in.pdf out.pdf owner_pwd
if the owner password is empty, please use it in this way,
pdfcrypt decrypt in.pdf out.pdf “”
It means if the pdf only encrypted with user password, you can easily remove the password without the password.
If you forget the owner password, you can try pdfcrack to get it and use PdfCrypt to remove the owner password