Set the key length when encrypting pdf files through command line

To make sure you understand this article, the lists two computer terms here.

Encryption is a sophisticated scrambling method that is designed to prevent unauthorized eavesdropping on electronic data. It works by taking a piece of information and processing it with a mathematical formula (called an "algorithm") that converts the information into a meaningless string of letters and numbers.

Key length is sometimes used to measure the relative strength of the encryption algorithm (i.e., the longer the key length, the more difficult the key is to decode). Encryption can be describes as 128-bit & 40-bit in terms of key length.  The main difference is that 128-bit encryption provides a significantly greater amount of cryptographic protection than 40-bit encryption.

This article uses---Set the key length to 40 when encrypting pdf files---as example to illustrate how to set the key length when encrypting pdf files through Advanced PDF Tools Command Line.

Step 1 click the following link to download Advanced PDF Tools

please unpack it when download is finished.

Step 2 launch the MS-DOS command prompt window. Because the command line is bound to be operated under the MS-DOS environment. The procedure is easy, and the following pictures will guide you.

1) click “start” and then go to “Run”

click start and choose run

2) input cmd into the following

inputting cmd

3) press “ok”, you will find MS-DOS command prompt window popping up

 command prompt

Step 3 input command line to set the key length when encrypting pdf files

it goes below

pdftools.exe -i C:\*.pdf -o D:\*.pdf  -S openpwd=123 -S keylen=0


  •  -i is to specify a pdf filename or a directory for input,
  •  -o is to specify the pdf file name for output,
  • -S openpwd=123 to set an open password as 123
  • -S keylen=0 refers to 40 bit RC4 encryption (Acrobat 3 or higher)


     -S "keylen=0"    : 40 bit RC4 encryption (Acrobat 3 or higher)
    -S "keylen=1"    : 128 bit RC4 encryption (Acrobat 5 or higher)
    -S "keylen=2"    : 128 bit AES encryption (Acrobat 7 or higher)

when the input is done, press “enter” key, you will see

detailed operation in  command prompt

Step 4 open the file to check if opening the file an open password is needed

window for inputting password of output pdf file

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Code   If you cannot see the CheckCode image,please refresh the page again!