pdfcipher - A command-line tool for encrypting and decrypting PDF files with password protection
- Author: James Cherti <https://www.jamescherti.com/>
- License: GPL 3.0 or later
The pdfcipher command-line tool enables encrypting and decrypting PDF files with password-based protection. It sets or removes passwords on individual PDF files or entire directory trees, updating the files in place.
Features
- Encrypts and decrypts PDF documents using 256-bit AES encryption via
qpdf. - Supports passing individual files, directories, or a mix of both.
- Recursively searches directories to find and process all PDF files.
- Updates files in place safely using temporary files to avoid partial writes.
- Handles file paths containing spaces, parentheses, and other special characters.
- Validates passwords with confirmation on encryption, and prompts again if a file requires a different password during decryption.
Requirements
- Python 3.10 or later
- The qpdf command-line tool
Installation
To install the pdfcipher executable locally in ~/.local/bin/ using pip, run:
pip install --user pdfcipher
(Omitting the --user flag will install pdfcipher system-wide in /usr/local/bin/.)
Usage
pdfcipher [--option] {enc,dec} files_or_dirs [files_or_dirs ...]
Encrypt
Encrypt PDF files or directory trees:
pdfcipher enc file1.pdf "my document (draft).pdf" /path/to/folder/
The tool prompts for a password and a confirmation password. It then encrypts the target files in place using 256-bit AES encryption. When directories are supplied, pdfcipher searches them recursively and processes every discovered PDF.
Decrypt
Decrypt PDF files or directory trees:
pdfcipher dec file1.pdf "my document (draft).pdf" /path/to/folder/
The tool prompts for the password and removes encryption from the files in place. If an individual file fails decryption due to a mismatched password, pdfcipher prompts for the correct password and continues processing the remaining files.
License
Copyright (c) 2023-2026 James Cherti
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Links
Metadata
Release files for pdfcipher 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pdfcipher-1.0.3.tar.gz | 9.2 kB | Without provenance | Details for pdfcipher-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pdfcipher-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for pdfcipher-1.0.3-py3-none-any.whl |
Total release size: 17.3 kB
Release files / pdfcipher-1.0.3.tar.gz
| Download URL | pdfcipher-1.0.3.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
312352755c28ebaeb2dbf1469aa00a6455cc8f2ad5b1436899d01c4416016e24
|
|
BLAKE2b-256 checksum How to use checksums |
cd96302689e53a374f4d31ee5f4eb5d0b2ecebfcc8776ef3fc88c2c9909ae477
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Release files / pdfcipher-1.0.3-py3-none-any.whl
| Download URL | pdfcipher-1.0.3-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
080ec7c0076e4e532017fbb5fa722767cc32902cf72cb2faf7e7792db7f1d022
|
|
BLAKE2b-256 checksum How to use checksums |
ec287e17625a0f2fb67f1abf363a610459cf6819e9cb8e4a232a0b7974089321
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Security for pdfcipher 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.