Encrypt or Decrypt Files on the Server

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"