Python CLI application to easily encrypt and decrypt file and folders. Easy and fast for the loversof the CLI.
Project description
PyCryptex
This project is a CLI application for encryption and decryption using the pycryptodome package. For the CLI functionality it uses Click package.
Configuration for developers
If you want to contribute to that project, after cloning the repo type:
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install --upgrade setuptools
pip install -r requirements.txt
# (optional) to test type
python3 -m Crypto.SelfTest
If you need to create a new key pair you can use ssh-keygen. In such case type:
ssh-keygen -t rsa -b 4096 -C "<your-user>@<your-domain>"
To install the executable package type:
pip3 install --editable .
To install from PyPi test (other dependencies packages from official PyPi) type:
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pycryptex==<version>
To test the application type:
pytest
Install application
If you like pycryptex and you want to use simply type:
pip3 install pycryptex
Using application
You can get help with:
pycryptex --help
PyCryptex can encrypt using symmetric or asymmetric algorithms based on the arguments passed.
To the standard encryption/decryption pycryptex uses RSA keys pair. In particular encrypt using the public key of the user and decrypt
using the private key. For better performance pycryptex behind the scene uses for encryption and decryption the AES algorithm.
The RSA keys are used to encrypt and decrypt the random key generated and stored as header to the file.
In this way the performance are definitely better on a large file (a 256 bit AES random key is used).
The default keys name:
- my_key: for the private key
- my_key.pub: for the public key
The folder where
pycryptexsearches for the key is your $HOME/.pycryptex. If you prefer to use your own keys you can pass them directly as an argument to the encrypt and decrypt method.
Configuration file
PyCryptex reads a configuration file located in your $HOME/.pycryptex folder named pycryptex.toml. The file has the following syntax (reported are the default file):
[config]
# path to the pager application where to see decrypted file
pager = "vim"
# number of seconds the application will delete a file decrypted passing the s option flag
wait_delete_time = 2
List of all commands
To an explanation of all the option of a specific command take a look directly at:
pycryptex encrypt --help
Follow the list of commands:
encrypt: to encrypt a single filedecrypt: to decrypt a single filecreate-keys: to create a public key and private key pair.create-config: to create the default config file under $HOME/.pycryptex/pycryptex.toml
Some examples
Some basic example usages are:
# to encrypt passing a key
pycryptex encrypt --pubkey test/id_rsa.pub test/secrets.txt
# to encrypt using the my_key.pub in $HOME/.pycryptex folder
pycryptex encrypt test/secret.txt
# to decrypt and delete the encrypted file
pycryptex --verbose decrypt --privkey test/id_rsa --remove test/secrets.txt.enc
# decrypt, open the pager and then delete the decrypted file
pycryptex --verbose decrypt --privkey test/id_rsa -s -p test/secrets.txt.enc
# decrypt, open the pager and then delete the decrypted file (loading keys from $HOME/.pycryptex)
pycryptex decrypt -sp test/secrets.txt.enc
# to create private and public key pair
pycryptex create-keys
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycryptex-0.3.0.tar.gz.
File metadata
- Download URL: pycryptex-0.3.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3c0472da5a08c01dedbe2c807cf6e8b5d5746341e89c2175da9b2f38b577ac6
|
|
| MD5 |
2f240c512f048e5baa0d2129f8c66827
|
|
| BLAKE2b-256 |
888af3e913d151c594e4b04c3860762a79fa926dc1917ad880b1632f85eb585b
|
File details
Details for the file pycryptex-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pycryptex-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fc51116e9733cd98a604d37787968461a0f175f91ee57ce855aee5bdc81724b
|
|
| MD5 |
96f740c1620be1dade43914a9afe3278
|
|
| BLAKE2b-256 |
3022e2ac307690f573ed67e55b4aa0c9cd6e612ecf2255b1f45c042b1a0758d7
|