Running APCrypt
In This Chapter…
…you will learn how to use APCrypt to apply the encryption parameters from the last chapter to PDF files.
- Using Command-Line Options shows basic command-line syntax.
- Running APCrypt provides examples of applying encryption with APCrypt.
Using Command-Line Options
Command syntax
$apcrypt [options] input1.pdf [input2.pdf...]
Refer to General Command-Line Options for details on the general options.
Refer to Applying Standard Security for more information about the encryption options.
Running APCrypt
Applying encryption to a document
The following examples use the sample files securitysample1.pdf and securitysample2.pdf in the Samples subdirectory. The examples assume you are in the directory where you installed APCrypt. On Windows, the default location is C:\Appligent\APCrypt. On Unix, it is wherever you installed APCrypt.
Applying 256-bit encryption to an unencrypted document
Use the -p flag to show progress, and the -o flag to specify an output file so the input PDF file will not be overwritten.
$apcrypt -p -o ./Samples/out_securitysample1.pdf -aes -keylength 256-ownerpass Pa55w0rd -userpass paSsWoRd -noprint./Samples/securitysample1.pdf
The out_securitysample1.pdf will be a new PDF document, encrypted with 256-bit encryption, with owner and user passwords. It will not allow you to print the document.
Applying 128-bit encryption to an unencrypted document
Use the -p flag to show progress, and the -o flag to specify an output file so the input PDF file will not be overwritten.
$apcrypt -p -o ./Samples/out_securitysample2.pdf -aes -keylength 128-ownerpass Pa55w0rd -userpass paSsWoRd -nomodify -nohighres -nocopy./Samples/securitysample2.pdf
The out_securitysample1.pdf will be a new PDF document, encrypted with 128-bit encryption, with owner and user passwords. It will not allow changes, high resolution printing, or copying the document.
Applying 40-bit encryption to a previously encrypted document
Use the -p flag to show progress, and the -o flag to specify an output file so the input PDF file will not be overwritten.
$apcrypt -p -o out_reencrypted.pdf -keylength 40 -d oldPassword-ownerpass PaSsWoRd -noprint -nomodify -nocopy./Samples/out_securitysample1.pdf
The out_reencrypted.pdf will be a new PDF document secured with 40-bit encryption and an owner password against printing, modifying and copying the document.
Removing encryption from a document
Use the -remove option to remove encryption from a document. Use the -p flag to show progress, and the -o flag to specify an output file so the input PDF file will not be overwritten.
$./apcrypt -p -remove -o ./Samples/Testfiles/out_securityremoved.pdf-d oldpassword ./Samples/out_securitysample1.pdf