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
.
Build
To build 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.
-
cd
to thecryptor-cli
directory. -
Type
go build
.
Use
./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"