Crypto play is a python3 script to encrypt and decrypt files content not file itself, using AES 256bits CTR, EAX modes and RSA. It uses PyCryptodome library to perform its operation.
In order to be able to run this script, you have to install the required librairies as follows:
pip3 install -r requirements.txt
- AES:
- size: 256
- mode: CTR, EAX. By default it uses CTR mode
- RSA:
- size: 2048 by default. one can specify other key size i.e 4096
-
The script expect an input file containing the data to encrypt or decrypt.
-
An output file where to save the result of operation (optional)
-
When encrypting in AES, a secret code will be asked so that it can be used with a generated salt to derive the key
-
If output file is specified, the operation result will be saved in it.
-
In all cases the result will be printed on screen.
-
in RSA, when a key is not specified it will generate a keypair (public & private) following this pattern: public_FILENAME.pem / private_FILENAME.pem
-
NB: After being encrypted , the contents are encoded in base64. Hence the output file contains the encoded of the ciphered text.
let's suppose we are in the script directory and there is a file in it called: confidiential.txt.
To encrypt the content using AES EAX mode:
./cryptoplay.py encrypt -a aes -m eax -if confidential.txt -of secrets.enc
To decrypt in that same mode:
./cryptoplay.py decrypt -a aes -m eax -if secrets.enc -of pt.txt
To encrypt in RSA with a key size 4096 bits
python3 cryptoplay.py encrypt -a rsa -b 4096 -if INPUT_FILE -of OUTPUT_FILE
To decrypt in RSA :
python3 cryptoplay.py decrypt -a rsa -k PRIVATE_KEY -if CIPHERED_FILE -of OUTPUT_FILE
python3 cryptoplay.py --help