APCrypt Users Guide

 

Control Access to PDF Files and Generate Secure PDF Envelopes for Other File Types

# apcrypt - [options] [-o outFilePath] inPDFFile
Usage: apcrypt [options]

-keypath <string> : Path to key location
-rc4 : Encrypt using the RC4 encryption algorithm
-aes : Encrypt using the AES encryption algorithm
-keylength <int> : Key Length. Valid options are 40, 128 & 256. Default is 128.

-ownerpass <string> : New Owner Password (Required)
-userpass <string> : New User Password

-onlyattach : Encrypt attachments only; uses AES encryption algorithm.

-noprint : Do Not Allow Printing
-nomodify : Do Not Allow Modifying the Document
-nocopy : Do Not Allow Copying text or graphics
-nonotes : Do Not Allow Adding or changing notes or form fields
-nofill : Do Not Allow Fill or Sign of Form Fields
-noaccess : Do Not Allow Accessibility
-noassembly : Do Not Allow Document Assembly
-nohighres : Do Not Allow High Resolution Printing

-remove : Remove all encryption from the PDF document. (requires -d OwnerPassword)

-d <string> : Old Owner Password to Decrypt the file

-optimize : Combine -flate, -rascii, -nolzw, -optxobj, -optcontent and -optfonts

-nocomp : Do not compress using Object Streams; compatible with all versions of Acrobat
-comp : Compress using Object Streams; Acrobat 6 and later
-iso32000 : Set file for ISO 32000 compliance (PDF 1.7)

-w : Linearize saved file
-nomod : Retain current file modification date
-o <string> : New output file name, for multiple inputs, a path to an output directory
-l <string> : Write progress to the given log file name
-p : Log progress information
-v : Print version information
-r <string> : Application serial number
-h : Show help
-help : Show help

Overview

APCrypt is a command-line driven server-based application that applies standard Acrobat security features to PDF documents quickly and efficiently. It is designed to run in tandem with other processes in an unattended environment able to handle high-volume and on-demand production needs. A copy of Adobe® Acrobat® is not needed in order for security to be applied.

Encryption Features

Encryption may be applied with 40, 128 or 256-bit security. Different security features are available at the different encryption levels. If a document is already encrypted, and has an Owner password, the document can be re-encrypted with different security options, or encryption can be removed completely.

At any encryption level, a password may be assigned. There are two types of passwords:

  • User password: used to open a document
  • Owner password: used to change permissions and passwords

When applying any security features, you must set an Owner password so that the settings can not be changed by other users.

At the 40-bit encryption level, the following security features are available:

  • Do not allow printing
  • Do not allow modifying the document
  • Do not allow selecting text and graphics
  • Do not allow adding or changing notes and form fields

At the 128-bit or 256-bit encryption level, these are the additional security features available:

  • Do not allow fill-in or signing of form fields
  • Do not allow accessibility
  • Do not allow document assembly
  • Do not allow high-resolution printing

As a server-based command-line driven application, APCrypt can be easily integrated into your scripts to add security to already processed documents.

Introduction

APCrypt is a command-line driven server-based application that applies standard Acrobat security features to PDF documents. APCrypt is designed to run in tandem with other processes in an unattended environment and to handle high-volume and on-demand production needs.

Memory Requirements

Minimum free memory available to run the application: 512 MBytes.

Windows Installation

Windows installation is handled by the installer and does not require any special handling.

Unix Installation

Setting environmental variables (All Unix Platforms)

In version 4.0 and higher, there are two additional environmental variables that need to be set for APCrypt on all UNIX platforms. If you run APCrypt from the apcrypt script created during installation, these environmental variables will be set by the script. If you run apcryptapp directly, you will need to set these environmental variables to run APCrypt. Once APCrypt is installed, you can view the variables needed by looking at the apcrypt script created by the installer.

Setting the Appligent home directory (All Unix Platforms)

The environmental variable that stores the location of the Appligent home directory is APPLIGENT_HOME. The default location for the Appligent home directory is /usr/local/appligent. The Appligent home directory contains the library files and resources needed to run APCrypt. It also contains license information for APCrypt.

Example:

export APPLIGENT_HOME=/usr/local/appligent

Setting the APDFL library path (All Unix except AIX)

The APDFL library path must be added to the LD_LIBRARY_PATH variable. The APDFL library path is located in a subdirectory of the APPLIGENT_HOME directory.

The path should be set to ${APPLIGENT_HOME}/APDFLX.X.X/Libs

Example:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${APPLIGENT_HOME}/APDFLX.X.X/Libs

Setting the APDFL library path (AIX Only)

The APDFL library path for AIX must be added to the LIBPATH variable. The APDFL library path is located in a subdirectory of the APPLIGENT_HOME directory.

The path should be set to ${APPLIGENT_HOME}/APDFLX.X.X/Libs.

Example:

export LIBPATH=${LIBPATH}:${APPLIGENT_HOME}/APDFLX.X.X/Libs

Registration numbers for APCrypt 5.0

In previous versions of APCrypt, the APCrypt registration number was required as a command line option with the -r flag each time apcryptapp was run. An apcrypt script was provided that automatically added -r and the registration number to the apcryptapp command line when the script was run.

In the current release, in addition to getting the registration number from the command line, APCrypt can get the registration number from a license file in the appligent home directory. On unix systems, license files are created by the installation script and stored in the ${APPLIGENT_HOME}/license directory. For windows, the license file is created by the installer and stored in the All Users/Application Data/Appligent/License directory. With a valid license file, the -r is no longer required on the command line. The -r option can still be used as in previous versions, and will override the value in the license file.

To upgrade a Demo Version of APCrypt 5.0

As mentioned in the previous paragraph, registration numbers are now stored in the license directory. The license file for ApCrypt 5.0 is called APCT_50.arn. To upgrade a demo version of ApCrypt, change the demo number stored in the license file to your new registration number. If you call the apcryptapp executable with the -r option directly from a script or program that you wrote, update the number in that file.

Type apcrypt -v on the command line and press Enter. The new registration number, and a message that it is valid, should be displayed.

Supported Platforms

Windows: NT, 2000, XP, Vista & above
Linux:  64 bit
Solaris: 10 and above on SPARC

Introduction

The following general options deal with reporting, logging, and file maintenance.

Sample command

The following command displays usage information for APCrypt:

$apcrypt -h

Summary

The following table provides a summary of the general command-line options.

Option Parameter Description
-r <RegNum> Pass registration number to APCrypt
-l <logfile> Write progress information to logfile
-p   Provide progress messages
-v   Display version information
-h or -help   Display usage information
-w   Linearize the file upon save
-o <outfile.pdf> Save output to a new file or directory
-optimize   Optimize the output file to try to reduce file size (APCrypt 4.0 only)
-nocomp   Do not compress using Object Streams; compatible with all versions of Acrobat (APCrypt 4.0 only)
-comp   Compress using Object Streams; Acrobat 6 and later (APCrypt 4.0 only)
-iso32000   Set file for ISO 32000 compliance (PDF 1.7) (APCrypt 4.0 only)


Detailed Options

The following sections provide details on using the general command-line options.

-r <RegNum> — Pass registration number to APCrypt

This option can be used to supply your registration number to APCrypt from a script or another application:

$apcryptapp -r XXXX-XXXX-XXXX-XXXX-XXXX-XXXX [other options]

This option is typically not necessary and is available for use in cases where the Appligent License File can not be located by the application because of runtime environment restrictions.

-l <logfile> — Log to a log file

Write to a text file any errors and/or progress messages. This option is helpful for debugging. The -l <logfile> option must be followed by a file name.

Note: If the log file you specify is a read-only file, a warning is displayed and nothing is written to the log file. Make sure that your log file is write-enabled.

Note: Your log file will look different if you are also using the -p option, see A note on using -p and -l <logfile> together.

-p — Show progress

Write progress messages to the screen (STDOUT — the standard output of your system). This option is helpful for debugging and for understanding how the utility works.

Note: Please see the following section for more clarification on using log files and writing progress messages to the screen.

A note on using -p and -l <logfile> together

As outlined in the above sections, the -p option gives you progress messages on your screen and the -l <logfile> option writes error messages to a file if errors occur. The following table provides more detail on using these options alone or together.

-l -p Errors Results
Green check mark

 

    Nothing will be written to the screen or to the log file you specify.
  Green check mark   Progress messages will be written to the screen and apcrypt.log.
Green check mark Green check mark   Progress messages will be written to the screen and to the log file you specify.
    Green check mark The utility will create an apcrypt.log file with the errors in your working directory.
Green check mark   Green check mark Errors will be written to the log file you specify.
  Green check mark Green check mark The utility will create an apcrypt.log file and write the errors  and progress messages to the file and your screen.
Green check mark Green check mark Green check mark Both progress and error messages will be written to the screen and to the log file you specify.

Therefore, -l <logfile> used on its own will only go into action if there are errors. With -p and -l <logfile> combined you will get a text file with full details on the utility operation whether there are errors or not.

-v — Print version information

Display the version of the utility you are running. This is important when corresponding with Appligent support; in order to best understand your problem, we must know what version of the software you have. APCrypt will not do anything else if you use this option.

-h or -help — Show usage

Display all available options for the utility. APCrypt will not do anything else if you use either of these options.

-o <outFile.pdf> — Save to a new file or directory

Save the modified file as a new file. We recommend using this option so you do not overwrite your existing files. If you are processing more than one input file at a time, specify a directory to save the resulting files.

Note: Do not forget to specify the output file or directory, or the command will fail. When you encrypt/secure several files at one time and use the -o option, make sure to specify the name of an existing directory. If you specify a filename, all but the first of your original files will be overwritten.

-w — Linearize the file upon save

Save the output file as a linearized document. Linearization reorganizes the file to make it more efficient for web delivery. Individual pages can be rendered before the entire document has downloaded, so the user can start reading the document sooner.

There are four options available in APCrypt 4.x and later.

-optimize — Optimize the file (optional)

This flag will do the following: 1) encode any non-encoded streams using Flate compression, 2) remove ASCII85 filters from all streams, 3) replace LZW encoded streams with Flate encoding, 4) merge identical XObjects and images, 5) optimize common sequences in page content, and 6) merge identical font descriptors and encodings. This option will usually result in a smaller file size.

-nocomp — Do not compress using Object Streams (optional)

This flag will not compress Object Streams, resulting in a document that is compatible with all versions of Acrobat.

-comp — Compress using Object Streams (optional)

This flag will compress Object Streams, resulting in a document that is compatible with Acrobat 6.0 and later.

-iso32000 — Set file for ISO 32000-1 compliance (optional)

This flag sets the file for compliance with ISO 32000-1:2008 (PDF 1.7).

Acrobat Standard Security

Acrobat standard security allows you to control who can access your document and, by setting permissions, how much they can edit or print. Acrobat offers three levels of security:

  • Low-level encryption (40-bit key length) — Compatible with Acrobat versions 3 and later.
  • High-level encryption (128-bit key length) — Compatible with Acrobat versions 5 and later.
  • AES encryption (128-bit key length) — Available only with Acrobat 8 and later.
  • AES encryption (256-bit key length — available for SecurSign & APCrypt only) — Available only with Acrobat X, XI and DC.

High level encryption provides a higher level of security and finer control over security features. The minimum level of security that you can set is to allow any changes except extracting pages.

Once you set encryption on a document, it cannot be processed in other ways unless the password is available to the processing software. You can also change or remove encryption in Acrobat.

Owner and user passwords

All levels of security allow you to set passwords for the document:

  • User password: controls who may view a document.
  • Owner password (required): controls who may make changes to permissions and passwords securing a document.

You must set an Owner password to apply encryption. Do not use the same password for both User and Owner. If the same password is used for both, only the User password will be set.

Different versions of Acrobat use different terminology to refer to the same concepts. You’ll see more of this in High-level encryption password nomenclature as described in the following table for various versions of Adobe Acrobat:

Type Acrobat X, XI & DC
User Document Open
Owner Change Permissions

Encryption Permissions

Acrobat allows you to set various permissions to limit access to the information in the document. Adobe changes the use of permissions when they moved from 40-bit key lengths to 128-bit key lengths. The sections below detail the different options and permissions based on using 40-bit or 128/256 bit key lengths.

The following is an example of the security options in Acrobat X, XI & DC:

Document Security properties

Refer to Verifying Security Features for instructions on displaying the security options.

Encryption options

The table below describes low-level encryption options.

High level encryption provides additional security options as are defined in the table below.

Type Option Parameter Description
Encryption -encrypt   Encrypt using the RC4 stream cypher (same as -rc4)
-aes   Encrypt using the Advanced Encryption Standard (AES) algorithm (SecurSign & APCrypt)
-rc4   Encrypt using the RC4 stream cypher
-keylength 128 Key length. Valid options are 40, 128 or 256. Default is 128. (256 bit – SecurSign & APCrypt Only)
-ownerpass oPassword New owner password (required)
-userpass uPassword New user password
-onlyattach   Encrypt document attachments only using AES; to use the PDFas a secure envelope for the attachments (requires -userpass) (SecurSign Only)
-remove   Remove all encryption from the PDF document. (Requires -ownerpass)
-d Password Old owner password – (Except AppendPDF & AppendPDF Pro)
Permissions -noaccess   Do not allow accessibility (128 & 256) – (256 bit – SecurSign & APCrypt Only)
-nocopy   Do not allow copying text or graphics
-noprint   Do not allow printing
-nohighres   Do not allow high resolution printing (128 & 256) – (256 bit – SecurSign & APCrypt Only)
-nomodify   Do not allow modifying the document
-nonotes   Do not allow adding or changing notes or form fields
-nofill   Do not allow filling in form fields or signing (128 & 256) – (256 bit – SecurSign & APCrypt Only)
-noassembly   Do not allow document assembly (128 & 256) – (256 bit – SecurSign & APCrypt Only)

The first four permissions can be used in any combination, except you can’t use -noprint and -nohighres together. Choose one or the other. The last four must be used in specific combinations that Acrobat accepts.

-encrypt — Encrypt output file (optional)

Specifies applying encryption to the output file using the RC4 stream cypher. This option is the same as -rc4.

-aes — Encrypt using the AES cryptography algorithm (optional) (SecurSign & APCrypt Only)

Encrypt the output file using the Advanced Encryption Standard (AES) cryptography algorithm.

-rc4 — Encrypt using the RC4 cryptography algorithm (optional)

Specifies applying encryption to the output file.

-keylength <int> — Encryption level (optional)

Specifies the encryption key length used to encrypt the document: either 40-bit, 128-bit or 256-bit. (256- bit SecurSign & APCrypt Only)

If you do not specify key length, the default is 128-bit.

-ownerpass <password> — New owner password (required)

Specifies a new Owner password to apply encryption. An Owner password restricts you from altering the security settings. You are not prompted for a password to open the document, only if you try to change the security settings. Passwords are case sensitive and are required when applying encryption.

Choose passwords carefully. They should not be able to be guessed easily but at the same time should not be too difficult for you to remember. If you forget a password, there is no way to recover it from the document. Therefore, it is a good idea to note passwords in another secure location.

-userpass <password> — Set user password (optional)

Specifies a User password for the document. Setting a User password prevents a document from being opened unless the correct password is supplied. Passwords are case sensitive.

Below is the Document Open Password dialog box.

Document Open Password dialog in Acrobat

When someone tries to open the document in Acrobat they will be asked for the password.

User password is optional. If you do not specify a User password, anyone can open the document.

-onlyattach — Secure Envelope(optional) (SecurSign Only)

Utilize PDFs as secure envelopes; apply 256-bit AES security to PDF and non-PDF file attachments while leaving the PDF itself unencrypted.

-remove — Remove all encryption from the PDF document

Removing encryption from the PDF document requires the document owner password using -ownerpass.

-d <string> — Old owner password to decrypt the file (Not available for AppendPDF & AppendPDF Pro)

If a PDF file already has encryption set and you wish to change the settings or remove encryption (APCrypt/SecurSign only), you need to supply the owner password in order to make changes to the file.

Document Permissions

-noprint — Do not allow printing (optional)

Specifies that the document cannot be printed. When the document is opened, the print icon on the toolbar and the Print option under the file menu will be grayed out.

At the 128-bit and 256-bit encryption level there is also an option to allow low resolution printing only. See the section High-level encryption for more detail.

-nomodify — Do not allow modifying the document (optional)

Specifies that the document cannot be modified. You will not be able to modify text or pages in the document when this option is used. You can fill in form fields, or add notes or other annotations.

With -nomodify, the following tools are grayed out and cannot be used when the document is opened in Acrobat:

  • Crop tool
  • Movie tool
  • Link tool
  • Article tool
  • Form tool
  • Digital Signature tool

Text can be selected for copying but cannot be cut, pasted or cleared.

-nocopy — Do not allow copying text or graphics (optional)

Specifies text and graphics cannot be copied.

With -nocopy, the following tools are grayed out and cannot be used when the document is opened in Acrobat:

  • Text Select tool
  • Touch-Up Text tool
  • Table/Formatted Text Select tool

-nonotes — Do not allow adding or changing notes or form fields (optional)

Specifies that annotations cannot be added or changed in the document. Annotations include notes, highlighted text, form fields and pencil marks. Annotations can be in text, graphic or audio format, or even attached external files.

With -nonotes, the following tools are grayed out and cannot be used when the document is opened in Acrobat:

  • Notes tool
  • Pencil tool
  • Highlight Text tool
  • Form tool
  • Digital Signature tool
  • Free Text tool
  • Sound Attachment tool
  • Stamp tool
  • File Attachment
  • Square tool
  • Circle tool
  • Line tool

-noaccess — Do not allow accessibility (optional)

Specifies content accessibility is not allowed. Content accessibility provides the vision and motion-challenged community with the tools and resources to make digital information more accessible. To learn more about content accessibility consult the Acrobat Help guide within Acrobat.

-nohighres — Do not allow high resolution printing (optional)

Specifies low resolution printing only. Acrobat prints each page as a low resolution (150 dpi) bitmap. The document cannot be recreated from these printouts.

-nofill — Do not allow filling form fields or signing fields

Specifies that no changes can be made to form fields or digital signature fields. This setting effectively prevents a filled-in form from being changed.

-noassembly — Do not allow document assembly

Specifies that no new pages can be added or removed from the PDF document. Also prevents rotating pages in the document. Effectively prevents pages being removed from the PDF document to be used elsewhere.

Permissions Allowed with 40-bit Encyption

The table below shows how the software application security options correspond to Acrobat’s security restrictions. The “Changes Allowed” column below lists the features still available after the document is secured.

Option Restrictions Set
(Not Allowed)
Changes Allowed
-nocopy Content Copying or Extraction
Content Accessibility
 
-noprint Printing  
-nomodify
-nonotes
Changing the Document
Document Assembly
Authoring Comments and Form Fields
Form Field Fill-in or Signing
None
-nomodify Changing the Document
Document Assembly
Commenting, filling in form fields, and signing
-nonotes Authoring Comments and Form Fields Page layout, filling in form fields, and signing
none   Any except extracting pages

Permissions Allowed with 128-bit or 256-bit Encryption

Acrobat accepts certain combinations of the “Changes Allowed” options. The Changes Allowed options are:

  • -nomodify — Do Not Allow Modifying the Document
  • -noassembly — Do Not Allow Document Assembly
  • -nonotes — Do Not Allow Adding or Changing Notes or Form Fields
  • -nofill — Do Not Allow Filling In or Signing of Form Fields

The table below shows security options vs. restrictions set with high level encryption. These combinations are discussed below.

Option Restrictions Set
(Not Allowed)
-noaccess Content Accessibility
-nocopy Content Copying or Extraction
-noprint Printing
-nohighres Only Low Resolution Printing is allowed
-nomodify
-nonotes
-nofill
-noassembly
Changing the Document
Authoring Comments and Form Fields
Form Field Fill-in or Signing
Document Assembly
-nomodify
-nonotes
-nofill
Changing the Document
Authoring Comments and Form Fields
Form Field Fill-in or Signing
-nomodify
-nonotes
-noassembly
Changing the Document
Authoring Comments and Form Fields
Document Assembly
-nomodify
-noassembly
Changing the Document
Document Assembly
none  

Allow no changes with -nomodify -noassembly -nonotes -nofill

Turning off all changes means: do not allow document modification (-nomodify), do not allow document assembly (-noassembly), do not allow the adding or changing of notes or form fields (-nonotes) and do not allow the fill-in or signing of form fields (-nofill). These options must all be used together for this setting to be made.

Allow inserting, deleting, and rotating pages with -nomodify -nonotes -nofill

This setting only allows document assembly.

These options specify: do not allow document modification (-nomodify), do not allow the adding or changing of notes or form fields (-nonotes) and do not allow the fill-in or signing of form fields (-nofill).

Allow filling in form fields, and signing with -nomodify -noassembly -nonotes

This setting only allows form field fill-in or signing.

These options specify: do not allow document modification (-nomodify), do not allow document assembly (-noassembly), and do not allow the adding or changing of notes or form fields (-nonotes).

Allow commenting, filling in form fields, and signing with -nomodify -noassembly

This setting allows the adding or changing of notes or form fields and the fill-in or signing of form fields.

These options specify: do not allow document modification (-nomodify), and do not allow document assembly (-noassembly).

Allow any except extracting pages with no options

If you don’t use any Changes Allowed options, Acrobat will allow any changes except extracting pages.

Verifying Security Features

To view the current security settings:

Acrobat X, XI and DC Select File > Properties. Click the Security tab, then click the Show Details… button.

In the example shown below, both a User password and an Owner password are set, only low resolution printing is allowed, changing the document, content copying and extraction, authoring comments and form fields, and form field fill-in or signing are not allowed, content accessibility and document assembly are allowed and encryption is 128-bit.

Document security properties


Example Commands

In the example below, an owner password is set on the document, high resolution printing (-nohighres) is applied, assembly (-noassembly) of other PDF files with input1.pdf is disabled and the output file, output.pdf, is created in the newpath directory.  Since the -keylength option is not set, the default encryption will be 128-bit.

apcrypt -ownerpass Pa55w0rd -nohighres -noassembly path\input1.pdf -o newpath\output.pdf

The next example, a user and owner password are set on the document, printing is disabled (-noprint), modifying the document is applied (-nomodify), encryption is set to 40-bit, three input files are processed and the output files are placed into the “out” directory.

apcrypt -userpass pa55w0rd -ownerpass Pa55w0rd -noprint -nomodify -o .\out -keylength 40 path\input1.pdf path\input2.pdf path\input3.pdf

Security Features in APCrypt 4.0 and above

Apply 128-bit AES or 256-bit AES encryption to PDF documents; the latest and most secure Adobe Acrobat standard encryption mechanism, fully compatible with Adobe Acrobat 9.x.

Utilize PDFs as secure envelopes; apply 256-bit AES security to PDF and non-PDF file attachments while leaving the PDF itself unencrypted.

-rc4: Encrypt using the RC4 cryptography algorithm

-aes: Encrypt using the AES cryptography algorithm

-keylength <int>: Key Length. Valid options are 40, 128 & 256. Default is 128.

If a file has been encrypted with AES 256, the file can only be opened under Acrobat 9 or you will receive the message “There was an error opening this document.   Acrobat cannot decrypt the document”. When viewing the Document Information on a file that is set with AES 256 encryption, the PDF Version will be set as 1.7, Adobe Extension Level 3.

-onlyattach: Encrypt attachments only using AES.  -onlyattach also requires the following flags on the command line:  -userpass <Password>,

-ownerpass <Password>, -aes -keylength 128 or 256

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

Introduction

This section describes the apcrypt command syntax and summarizes the options you can use with the apcrypt command.  Command-line syntax in the tables below refer to a path to any input or output file.  In the Windows environment, directory paths use a back slash “\” character. In the UNIX/Mac OS X environment, directory paths use a forward slash “/” character. Examples in the tables below show a Windows type path.

The following is an example of paths to the default installation directory for APCrypt:

Windows

> C:\Appligent\APCrypt\

UNIX

$ /Appligent/APCrypt/

Command Syntax

$apcrypt [options] path\inFilename.pdf [inFilename.pdf...]

Product Information Options

The following table describes options you can use to obtain information about APCrypt.  For more information about these options, see Introduction to APCrypt.

Option Function Description Example
-v Print version information Displays the version of APCrypt you are running. This is important when corresponding with support@Appligent.com. In order to best understand your problem, we must know what version of the software you have. apcrypt -v
-h or
-help
Show help Displays all available command-line options, plus version information. apcrypt -h
apcrypt -help

Input and Output Options

The following table describes the options for managing file input and output. For more information about these options, see General Options – APCrypt.

Option Function Description Example
-d <oPassword> Owner password to change encryption to this document The password required to change encryption settings on a PDF document. Passwords are case sensitive.Choose passwords carefully. They should not be able to be guessed easily but at the same time should not be too difficult for you to remember. If you forget a password, there is no way to recover it from the document, therefore, it is a good idea to note passwords in another secure location. apcrypt -d oPa55w0rd
[options] path\inFilename.pdf
[inFilename.pdf…]
-u <uPassword> User password to open this document The password required to open a PDF document encrypted with a User password. Secured PDF files can have two types of passwords: User passwords and Owner passwords. A User password is also known as an Open password, because it is used to open documents. If you want your document encrypted with a User password, you must supply the password immediately following the -u option. apcrypt -u uPa55w0rd
[options] path\inFilename
-o <outFilename> Output filename Specifies a new output PDF file. The name, including the path, must immediately follow the -o option. If you want your output file to go to a particular directory, be sure it exists beforehand. This option is used if you do not want to overwrite the original file. apcrypt -ownerpass Pa55w0rd [options]
path\inFilename.pdf
-o path\out_Filename.pdf
 -w Linearize the PDF file upon save Save the output file as a linearized document. Linearization reorganizes the file to make it more efficient for web delivery. Individual pages can be rendered before the entire document has downloaded, so the user can start reading the document sooner. apcrypt -ownerpass Pa55w0rd [options]
-w path\inFilename.pdf

 

Reporting Options

The following table describes the options for reporting progress and error messages. These options are helpful for debugging and understanding how APCrypt works. For more information about these options, see General Options – APCrypt.

Option Function Description Example
-p Show progress Write progress messages to the screen (STDOUT—the standard output of your system). This option is helpful for debugging and for understanding how the utility works. apcrypt -p
-d oPa55w0rd [options]
path\inFilename.pdf
-l <logfile> Write progress to the given log file name Saves the progress and error messages to a user-specified text file instead of the default log file, apcrypt.log. The name of the text file must directly follow the -l option. (By default, APCrypt writes any error messages to the screen, STDOUT, and to the default log file, apcrypt.log.) apcrypt -l path\mylogfile.txt
-d oPa55w0rd [options] path\inFilename.pdf
-p and -l combined Write progress and error messages to the given log file name If the -p and -l options are both specified, progress and error messages will be written to the file that you specify. apcrypt -p
-l path\mylogfile.txt
-d oPa55w0rd [options] path\inFilename.pdf

Registration Number

The following table describes how to pass the registration number to APCrypt. For more information about this option flag, see General Options – APCrypt.

Option Function Description Example
-r <RegNum> Pass APCrypt registration number This option can be used to supply your registration number to APCrypt from a script or another application. This option is typically not necessary and is available for use in cases where the Appligent License File can not be located by the application because of runtime environment restrictions. apcryptapp -r XXXX-XXXX-XXXX-XXXX-XXXX-XXXX
-encrypt [options] path\inFilename.pdf
-o path\outFilename.pdf

Note: Do not call the apcrypt script from another script or application. Call apcryptapp directly with the registration number option, as shown in the example above.

Encryption Options

The following table describes how to use the encryption options available with APCrypt. For more information about these options, see Applying Standard Security – APCrypt.

Option Function Description Example
-encrypt Encrypt the output file (required) Specifies applying encryption to the output PDF file. Required when applying encryption.
The owner password is required when applying encryption by using either the -d <oPassword> (If input file is already encrypted) or -ownerpass <Password> options.
apcrypt -d oPa55w0rd
-encrypt [options]
path\inFilename.pdf [inFilename.pdf…]
-ownerpass <oPassword> New owner password Specifies a new Owner password to apply encryption. An Owner password restricts you from altering the security settings. You are not prompted for a password to open the document, only if you try to change the security settings. Passwords are case sensitive. Required when applying encryption.

 

Choose passwords carefully. They should not be able to be guessed easily but at the same time should not be too difficult for you to remember. If you forget a password, there is no way to recover it from the document, therefore, it is a good idea to note passwords in another secure location.

apcrypt -ownerpass Pa55w0rd
-encrypt [options]
path\inFilename.pdf [inFilename.pdf…]
-userpass <uPassword> Set user password Specifies a User password for the document. Setting a User password prevents a document from being opened unless the correct password is supplied. Passwords are case sensitive. apcrypt -userpass UPa55w0rd
-encrypt [options]
path\inFilename.pdf [inFilename.pdf…]
-keylength <int> Encryption level Specifies the level of encryption applied: either 40-bit (low), 128-bit or 256-bit. Specify -keylength 40 for low level encryption.

 

If you do not specify key length, high level (128-bit) is applied. For 256-bit, specify -aes -keylength 256.

apcrypt -ownerpass Pa55w0rd
-encrypt -keylength 40
[options] path\inFilename.pdf [inFilename.pdf…]
-remove Remove encryption from file Removes encryption from a PDF file. Requires -d <oPassword> option. apcrypt -d Pa55w0rd
-remove path\inFilename.pdf [inFilename.pdf…]

40-bit permissions

The following table describes the security provided by 40-bit encryption options.  For more information about these options, see Applying Standard Security – APCrypt.

Option Function Description Example
-noprint Do not allow printing Specifies that the document cannot be printed. When the document is opened, the print icon on the toolbar and the Print option under the file menu will be grayed out. apcrypt -ownerpass Pa55w0rd
-encrypt -keylength 40 -noprint [options]
path\inFilename.pdf [inFilename.pdf…]
-nomodify Do not allow modifying the document Specifies that the document cannot be modified. You will not be able to modify text or pages in the document when this option is used. You can fill in form fields, or add notes or other annotations. Text can be selected for copying but cannot be cut, pasted or cleared.

 

With -nomodify, the following tools are grayed out and cannot be used when the document is opened in Acrobat:

Crop Tool, Movie Tool, Link Tool, Article Tool, Form Tool, Digital Signature Tool

apcrypt -ownerpass Pa55w0rd
-encrypt -keylength 40 -nomodify [options]
path\inFilename.pdf [inFilename.pdf…]
-nocopy Do not allow copying of text or graphics Specifies text and graphics cannot be copied.

 

With -nocopy, the following tools are grayed out and cannot be used when the document is opened in Acrobat:

Text Select Tool, Touch-Up Text Tool, Table/Formatted Text Select Tool

apcrypt -ownerpass Pa55w0rd
-encrypt -keylength 40 -nocopy [options]
path\inFilename.pdf [inFilename.pdf…]
-nonotes Do not allow adding or changing notes or form fields Specifies that annotations cannot be added or changed in the document. Annotations include notes, highlighted text, form fields and pencil marks. Annotations can be in text, graphic or audio format, or even attached external files.

 

With -nonotes, the following tools are grayed out and cannot be used when the document is opened in Acrobat:

Notes Tool, Sound Attachment Tool, Pencil Tool, Stamp Tool, Highlight Text Tool, File Attachment, Form Tool, Square Tool, Digital Signature Tool, Circle Tool, Free Text Tool, Line Tool

apcrypt -ownerpass Pa55w0rd
-encrypt -keylength 40 -nonotes [options]
path\inFilename.pdf [inFilename.pdf…]

 

128-bit and 256-bit permissions

The following table describes the additional security options provided by 128-bit encryption options.  For more information about these options, see Applying Standard Security – APCrypt.

Option Function Description Example
-noprint Do not allow printing Specifies that the document cannot be printed. When the document is opened, the print icon on the toolbar and the Print option under the file menu will be grayed out. apcrypt -ownerpass Pa55w0rd
-encrypt -noprint [options]
path\inFilename.pdf [inFilename.pdf…]
-nomodify Do not allow modifying the document Specifies that the document cannot be modified. You will not be able to modify text or pages in the document when this option is used. You can fill in form fields, or add notes or other annotations. Text can be selected for copying but cannot be cut, pasted or cleared.

 

With -nomodify, the following tools are grayed out and cannot be used when the document is opened in Acrobat:

Crop Tool, Movie Tool, Link Tool, Article Tool, Form Tool, Digital Signature Tool

apcrypt -ownerpass Pa55w0rd
-encrypt -nomodify [options]
path\inFilename.pdf [inFilename.pdf…]
-nocopy Do not allow copying of text or graphics Specifies text and graphics cannot be copied.

 

With -nocopy, the following tools are grayed out and cannot be used when the document is opened in Acrobat:

Text Select Tool, Touch-Up Text Tool, Table/Formatted Text Select Tool

apcrypt -ownerpass Pa55w0rd
-encrypt -nocopy [options]
path\inFilename.pdf [inFilename.pdf…]
-nonotes Do not allow adding or changing notes or form fields Specifies that annotations cannot be added or changed in the document. Annotations include notes, highlighted text, form fields and pencil marks. Annotations can be in text, graphic or audio format, or even attached external files.

 

With -nonotes, the following tools are grayed out and cannot be used when the document is opened in Acrobat:

Notes Tool, Sound Attachment Tool, Pencil Tool, Stamp Tool, Highlight Text Tool, File Attachment, Form Tool, Square Tool, Digital Signature Tool, Circle Tool, Free Text Tool, Line Tool

apcrypt -ownerpass Pa55w0rd
-encrypt -nonotes [options]
path\inFilename.pdf [inFilename.pdf…]
-noaccess Do not allow accessibility Specifies Content accessibility is not allowed. Content accessibility provides the vision- and motion-challenged community with the tools and resources to make digital information more accessible. To learn more about content accessibility, consult the Acrobat Help guide within Acrobat. apcrypt -ownerpass Pa55w0rd
-encrypt -noaccess [options]
path\inFilename.pdf [inFilename.pdf…]
-nohighres Do not allow high resolution printing Specifies low resolution printing only. Acrobat prints each page as a low resolution (150 dpi) bitmap. The document cannot be recreated from these printouts. apcrypt -ownerpass Pa55w0rd
-encrypt -nohighres [options]
path\inFilename.pdf [inFilename.pdf…]
-nofill Do not allow filling form fields or signing fields Specifies that no changes can be made to form fields or digital signature fields. This setting effectively prevents a filled in form from being changed. apcrypt -ownerpass Pa55w0rd
-encrypt -nofill [options]
path\inFilename.pdf [inFilename.pdf…]
-noassembly Do not allow document assembly Specifies that no new pages can be added and no pages can be removed from the PDF document.  Effectively prevents pages being removed from the PDF document to be used elsewhere. apcrypt -ownerpass Pa55w0rd
-encrypt -noassembly [options]
path\inFilename.pdf [inFilename.pdf…]

APCrypt within a Document Processing and Delivery Solution

Adding security to a document should generally be the last step of processing. Appligent has available several products for processing PDF documents. Any of these, or a combination, could be used before applying security features with APCrypt. The products available are as follows:

  • AppendPDF Pro — Append several PDF documents or pages of documents together to produce one complete document. Add a cover page and a table of contents, as well as text and/or image stamps to any of the pages.
  • FDFMerge — Merge PDF forms together with FDF or XFDF data files to create a completed form. With FDFMerge’s form-flattening feature, form fields are removed making the output document more portable and less easily modified.
  • StampPDF Batch — Add text to PDF documents as headers or footers, watermarks, etc., which can include page numbers, date/time, file names, and more. Stamps can be in any RGB color, Adobe PostScript Type 1 font, point size, and position. They can be overlaid or underlaid text, outline text, invisible text and/or multi-line.

Note: If you would like more information on these and other Appligent products, visit our Appligent web site. Full documentation for each product is available on the web site. Most products have examples and/or demos.

The following is a graphical example of using APCrypt as part of a document processing solution that uses AppendPDF and StampPDF Batch before using APCrypt to add security features. (The work done by AppendPDF and StampPDF Batch could also be done by using the single product AppendPDF Pro.) Once the document is secured, it is ready for delivery.

Using APCrypt after document processing and before delivery

AppendPDF workflow

StampPDFBatch workflow

APCrypt workflow

Using APCrypt in a Perl Script

Using APCrypt within a Perl script requires a simple system call. Below we show first a call to StampPDF Batch where a document, file1.pdf, is applied with stamps as specified in stampfile.txt. Following that is a call made to APCrypt where standard security features are applied to the file file1.pdf (do not allow printing, allow only form fill-in or signing). Owner and user passwords are set to owner and user, respectively.

system "stamppdf stampfile.txt file1.pdf"; system "apcrypt -ownerpass owner
-userpass user -o outfile.pdf -keylength 40 -noprint -nomodify -nocopy
-nonotes file1.pdf";

If you use Perl to write a script that uses APCrypt, make a call to the application in the format shown above.

Example scripts may be found on the Appligent web site.

Introduction

APCrypt is a command-line application. If you are used to the Microsoft Windows or Apple Mac OS X operating system, you may not be familiar with running command-line tools. This section shows you all you need to get started.

  • Windows tells you how to use APCrypt on Windows.

Note: You can refer to the Getting Started With Command Line Applications for additional information on using command-line applications.

Windows

To run APCrypt in Windows, you need to open a Command Prompt window.

In Windows:

  • Click Start > Programs > Accessories > Command Prompt

The Command Prompt window opens.

Some basic commands

At the command prompt, you type each command, and press the Enter key to execute it. You can use the mouse to select text to copy or cut to the clipboard, but you cannot position the cursor with it. The command line is completely keyboard driven. Navigation keys are shown below:

Key Action
Backspace Delete previous character
Right arrow Move right one character
Left arrow Move left one character
Up arrow Recall previous command
Tab File or directory name auto complete
Enter Execute command

In addition to running programs, you have many commands to navigate and maintain the system. Two important ones are cd and dir.

Changing directories

Use the cd command to change directories. For example, to change to the directory that APCrypt is located in, type:

C:\>cd \appligent\apcrypt\

The command prompt changes to:

C:\Appligent\apcrypt>

to show you where you are.

To move back one level, use the shortcut of two periods (..)

C:\Appligent\apcrypt>cd..

Don’t forget to press the Enter key after every command. You will now be in this directory:

C:\Appligent>

Move back to apcrypt:

C:\Appligent>cd apcrypt

Listing the contents of a directory

Use the dir command to list the contents of a directory:

C:\Appligent\apcrypt>dir

The computer responds with a listing of all the contents of the apcrypt directory.

If the directory contents fly by too fast to read, do this:

C:\Appligent\apcrypt>dir /p

The /p switch tells DOS to display one page at a time. Press the Enter key to see the next page.

To see the contents of all the subdirectories at the same time, type:

C:\Appligent\apcrypt>dir /s

This displays the contents of apcrypt and all the subdirectories under it.

Running APCrypt

To run APCrypt, type the commands on the command line as shown in other sections of this manual and press Enter. In the next example, we’ve truncated the command prompt path for clarity. A simple command would be:

C:\path\>apcrypt.bat  -o Samples\output.pdf Samples\input.pdf

This processes the sample file and creates a new file named “output.pdf”.  Note we provide the relative path to the input and output files so that APCrypt knows where to find them. The safest way to specify files is to use the full path:

C:\path\>apcrypt.bat  "c:\appligent\apcrypt\Samples\input.pdf"

If you do not specify the correct path, you will get a “file not found” error.

Now, refer to the rest of this User Guide for details about using APCrypt.

Common Error Checklist

  • Remember to decrypt documents that have security features already applied. If the documents you are working with already have some security features applied, they will need to be decrypted with -d <ownerpass> for APCrypt to use them.
  • When using the log file option, -l <logfile>, be sure to give a logfile name. If this is not done, APCrypt will recognize the text string immediately following the -l as the name of the log file. For example, if your command line is accidentally:
    apcrypt -l -nomodify -nocopy -keylength 40 file.pdf

    the log file will be called “-nomodify” and the correct encryption features will not be applied.

  • Make sure all file and pathnames are correct. If you are working in one directory and APCrypt lives in another, you must account for that on your command line. This goes for all files: input and output files and log files. The best practice is to use full paths for all files.
  • If you get an error from APCrypt that the file was unable to write, check to make sure the file isn’t open in Adobe Acrobat or any other application. Also make sure you have write permissions in the directory and confirm the file is not read-only if you are trying to overwrite it.
  • Only PDF documents can be secured. APCrypt will fail if you try to secure a document that is not a PDF document. Be particularly aware of this if you are using wildcards to specify filenames. You may wish to include the .pdf suffix in all wildcards, such as file*.pdf, *.pdf, etc.

Cleaning Up PDF Documents

Not all PDF files are created equal. The way in which a PDF document is generated makes a difference, and PDFs generated by third party tools in particular can vary in quality. PDF documents can also become corrupted.

To check how the file was created:

  • In Acrobat X, XI and DC select File > Properties… and click Description. Under Advanced, look at PDF Producer.

If the PDF Producer field is blank, consider the file suspect.

Making a Clean PDF

If you are having problems with a specific PDF, try to create “clean” version of your document. There are two ways of doing this using Adobe Acrobat. If you use other PDF manipulation software, check the documentation for functions that may be equivalent to those found in Adobe Acrobat.

Method 1: “Optimize” your PDF

  • In Acrobat X, XI and DC > File Menu > Save As > Optimized PDF

If saving as optimized does not work, distill the document by following the steps below.

Method 2: Distilling PDF Documents

Distilling a document will remove all comments and form-fields from the PDF. If the PDF contains these items and you wish to preserve them, you must save them before Distilling.

To save existing comments

  • In Acrobat X, XI and DC select Comments > Comments List > click the Options icon > Export All to Data File… In the Export Comments dialog box, select a name and location for the Forms Data File (.fdf), and click Save.

See the additional step below for saving form fields (if any):

Delete all comments:

  • In Acrobat X, XI and DC select all the comments in the Comments List pane and press the Delete key.

To save form fields (if any):

  • Save a copy of the original file. You will copy and paste the form fields from the original file into the new file after the distilling procedure.

Distilling the document

To distill a PDF document do the following:

  • In Acrobat X and XI select File > Save As > More Options > PostScript. Choose a name and location for the file and click Save.
  • In Acrobat DC select File > Export to > PostScript. Choose a name and location for the file and click Save
  • Open Acrobat Distiller > select File > Open… In the Open PostScript File dialog, locate the PostScript file created in the previous step and click Open.

The distiller will create a new PDF file with the same name and location as the PostScript file.

Restoring comments

To restore the comments:

  • In Acrobat X and XI, select Comments > Comments List > click the Options icon > Import Data File… In the Import Comments dialog box, locate the Forms Data File (.fdf) previously saved and click Select. In the next pop-up box, click Yes. The comments are restored.
  • In Acrobat DC, select Tools > Comments > Comments List > click the Options icon > Import Data File…In the Import Comments dialog box, locate the Forms Data File (.fdf) previously saved and click Select. In the next pop-up box, click yes. The comments are restored

Restoring form fields

To restore form fields:

  • Open the original PDF file that includes form fields.
  • In Acrobat X and XI select Tools > Forms > Edit Form)
  • In Acrobat DC > select Tools > Prepare Form > Form fields will automatically appear
  • The form fields will appear, do a Control-A to select all the form fields.
  • Open the new distilled PDF file which has no form fields.
  • Do a Control-V to paste all the form fields onto the page.

You may need to reposition the fields by selecting them again with the Select Object Tool and moving them to the correct position. For multi-page forms you must do this for each page separately.

E-mail

You can contact support directly by sending an e-mail to support@appligent.com. Support e-mails are answered within one business day during the normal business hours listed below.  

Telephone & Fax

  • Telephone: +1 610 284 4006
  • Fax: +1 610 284 4233

To better serve you, please call us during our normal business hours, Monday - Friday, 8:00 am - 5:00 pm U.S. EST/EDT.

 

A member of our friendly, knowledgeable support staff will reply as soon as possible, generally within one business day.

International Support

Customers from locations outside the United States, including Germany, United Kingdom, Canada and Australia can contact us directly or connect with one of our many resellers.

When contacting support please provide the following information:

  • Name of the Product
  • Product Version Number
  • Operating System
  • Your Name
  • Company Name
  • Your Email Address
  • Your Phone Number
  • Product Registration Number
  • Any files to help us reproduce your problem (if needed)

Known Issues

If an input file has a user password set, the user password is copied over into the new output file even if -userpass <Password> is not supplied on the command line.

-d option must have Owner password

All encrypted documents that you decrypt with -d ownerpass must have an Owner password. You cannot use the -d option without an Owner password. If you have a legacy PDF document that was encrypted without an Owner password, you must create an Owner password for the document before using the -d option to decrypt it.

Form Fields

APCrypt cannot decrypt files with form fields. If you need to apply encryption to a document with form fields, delete them, remove encryption manually beforehand, or flatten them with FDFMerge.

Linearization

Linearization (-w) should not be used with files that contain articles.

To Get Help

Contact technical support by:

emailing support@appligent.com, or calling 610-284-4006

Please provide the following:

Product name and version number
Operating system
Your name, company name, email address, and phone number
Description of your question or problem

Responses are typically emailed within one business day.