This project is an exploration of the pyca/cryptography library, specifically focusing on symmetric encryption using Fernet. It demonstrates how to securely generate, store, use, and manage encryption keys, as well as encrypt and decrypt messages.
To run this project, you’ll need:
cryptography
libraryYou can install the required library using the following command:
pip install cryptography
The project consists of three Python files:
generate_key.py
:
secret.key
).encrypt_message.py
:
secret.key
file and encrypts a message.decrypt_message.py
:
secret.key
file and decrypts the encrypted message (token).Clone the Repository
git clone https://github.com/LahcenEzzara/pyca-cryptography-explorer.git
cd pyca-cryptography-explorer
Generate a Key
Run the generate_key.py
script to generate a new encryption key and save it to secret.key
:
python generate_key.py
Encrypt a Message
Use the encrypt_message.py
script to encrypt a message:
python encrypt_message.py
The script will display the encrypted message (token).
Decrypt a Message
To decrypt the encrypted message, run the decrypt_message.py
script and replace YOUR_ENCRYPTED_TOKEN_HERE
in the script with the encrypted token:
python decrypt_message.py
The original message will be displayed.
secret.key
) secure. Anyone with access to this key can decrypt your encrypted data.This project is licensed under the MIT License. See the LICENSE file for details.
Happy exploring the pyca/cryptography library!