PaperEncrypt is a Python tool for encrypting and decrypting files using AES encryption and QR codes. The encrypted data can be exported in multiple formats, including PDF, image (PNG), and text. Decryption supports reading QR codes directly from these formats, making it versatile for secure data sharing.
- Encrypt files: Supports AES encryption with user-provided passwords.
- Generate QR codes: Encrypted content is embedded into QR codes.
- Multiple export formats: PDF, image, and plain text.
- Decrypt files: Extract encrypted data from QR codes and restore the original content.
- All-in-memory processing: Uses in-memory buffers for improved performance.
PaperCrypt: Secure Offline Analog Storage Tool
Overview
PaperCrypt is a tool designed to securely store data offline in an analog format. It encrypts a text file and provides options to export the encrypted data as a PDF, image, or plain text. When exporting to PDF or image formats, a QR code containing the encrypted data is generated, making it easy to print and store. The data is encrypted using AES encryption and is protected by a password. Note: The password is unrecoverable, so it must be stored securely.
The primary purpose of PaperCrypt is to enable secure, analog storage of small pieces of sensitive data, such as passwords or cryptocurrency wallet public and private keys.
Steps for Secure Storage
- Write your data in a
.txtfile. - Encrypt the data using PaperCrypt. (Do not lose the password as it cannot be recovered.)
- Print at least two copies of the generated QR code and store them securely in geographically separated locations.
- Delete the
.txtfile and any encrypted files from your computer. (Remember to clear your trash bin.) - Done! Your credentials are now securely stored offline.
Steps to Decrypt Data
- Take a photo or scan the generated QR code.
- Use PaperCrypt to decrypt the data using the saved QR code and your password.
Disclaimer: Ensure you follow the recommended steps for secure storage and do not lose the password. Failure to do so may result in permanent loss of access to your encrypted data.
Ensure you have Python 3.7 or later installed.
Install the following Python libraries:
fpdfqrcodepycryptodomecv2(OpenCV)pdf2imagenumpy
You can install all dependencies using:
pip install -r requirements.txtFor pdf2image, you must install poppler. Instructions vary by operating system:
- Ubuntu:
sudo apt-get install poppler-utils - MacOS:
brew install poppler - Windows: Download the precompiled binaries from Poppler for Windows and add the
bindirectory to your PATH.
The tool provides a CLI interface for encryption and decryption.
python main.py --encrypt --file_path <file_path> [--export pdf,img,txt] [--title <title>]
python main.py --decrypt --file_path <file_path>--encrypt: Encrypt the file.--decrypt: Decrypt the file.--export: Specify export formats (comma-separated):pdf,img,txt(default:pdf).--output_path: (Optional) Path to save the output files.--title: (Optional) Title to add to the PDF.file_path: Path to the file to encrypt or decrypt.
python main.py --encrypt --file_path /path/to/file.txt --export pdf,img --title "My Encrypted File"python main.py --encrypt --title "My Encrypted File" "/path/to/*.txt"python main.py --decrypt --file_path /path/to/encrypted_file_encrypted.pdfpython main.py --decrypt --output_path=decrypt "/path/to/*.pdf"The tool provides encrypt_file and decrypt_qr functions for integration into your own projects.
from paper_encrypt.main import encrypt_file
file_path = "test_file.txt"
password = "securepassword"
encrypt_file(file_path, password, title="Secure Data", export_formats=['pdf', 'img'])from paper_encrypt.main import decrypt_qr
encrypted_file_path = "test_file_encrypted.pdf"
password = "securepassword"
decrypt_qr(encrypted_file_path, password)The project includes unit tests to verify its functionality. Run the tests with:
python -m unittest discover- Use strong passwords to ensure the safety of your encrypted data.
- Keep your password safe; decryption is impossible without it.
This project is licensed under the MIT License. See the LICENSE file for details.
For issues or feature requests, please contact the developer or submit an issue on the project repository.