Encrypt PDFs with AES on iOS

PSPDFKit for iOS bundles two tools you can use to encrypt documents with AES:

  1. Our AESCryptor tool

  2. The cryptor-cli command-line tool

AESCryptor Tool

When downloading the PSPDFKit for iOS SDK, we include a tool called AESCryptor, which lets you encrypt and decrypt files with ease. It’s located in the downloaded .dmg in Extras > AESCryptor > AESCryptor.app.

  1. Open the AESCryptor application and select the file you want to encrypt under Input. A Finder window will open and allow you to select your desired document.

  2. Now you need a password and salt to safely encrypt your file. This example uses the following values provided in PSCAESCryptoDataProviderExample.swift.

  • Password: afghadöghdgdhfgöhapvuenröaoeruhföaeiruaerub

  • Salt: ducrXn9WaRdpaBfMjDTJVjUf3FApA6gtim0e61LeSGWV9sTxB0r26mPs59Lbcexn

  1. Now click on Encrypt to complete the encryption process.

Here’s how it should appear in the end:


PSPDFKit for iOS bundles the cryptor-cli tool, which allows you to encrypt and decrypt files on a server. cryptor-cli is a standalone command-line tool written in Go, so it’ll work on Windows, macOS, and Linux/Unix. You can find cryptor-cli in the distribution DMG under Extras/cryptor-cli.


To build cryptor-cli on your system, follow these steps:

  1. Install Go. On Windows and macOS, package installers are available, and on Linux, you have to build from source.

  2. cd to the cryptor-cli directory.

  3. Type go build.


./cryptor-cli -h
Usage of ./cryptor-cli:
 -f=false: force overwrite of output file
 -in="": input file
 -o="encrypt": operation, can be [encrypt, decrypt]
 -out="": output file
 -p="": passphrase
 -s="": salt (optional)

Encrypt Example

./cryptor-cli -o "encrypt" -in "path/to/original.pdf" -out "path/to/encrypted" -p "test123" -s "salt"

Decrypt Example

./cryptor-cli -o "decrypt" -in "path/to/encrypted" -f -out "path/to/decrypted.pdf" -p "test123" -s "salt"