Encrypt PDFs with AES in iOS
PSPDFKit for iOS bundles two tools you can use to encrypt documents with AES:
Our 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.
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.
Now you need a password and salt to safely encrypt your file. This example uses the following values provided in
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
cryptor-cli on your system, follow these steps:
Install Go. On Windows and macOS, package installers are available, and on Linux, you have to build from source.
./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)
./cryptor-cli -o "encrypt" -in "path/to/original.pdf" -out "path/to/encrypted" -p "test123" -s "salt"
./cryptor-cli -o "decrypt" -in "path/to/encrypted" -f -out "path/to/decrypted.pdf" -p "test123" -s "salt"