A Python-based cybersecurity utility for securely encrypting and decrypting text messages and files using the Fernet symmetric encryption algorithm.
The Encryption / Decryption Tool is designed to demonstrate the practical use of cryptography in cybersecurity.
The tool can:
- Encrypt text messages
- Decrypt encrypted messages
- Encrypt files
- Decrypt encrypted files
- Generate and use a secure encryption key
- Handle invalid user input
- Prevent accidental file overwriting
- Python 3
- Cryptography Library
- Fernet Symmetric Encryption
- File Handling
- Exception Handling
The project uses Fernet symmetric encryption.
The same secret key is required for both encryption and decryption.
Plaintext message/file ↓ Secret Key ↓ Fernet Encryption ↓ Encrypted Data
Encrypted Data ↓ Secret Key ↓ Fernet Decryption ↓ Original Message/File
The user can enter a text message and the tool converts it into encrypted ciphertext.
The encrypted message can be decrypted using the correct secret key.
The tool can read a file as binary data and create an encrypted
.encrypted file.
An encrypted .encrypted file can be decrypted back into its
original form.
The program handles:
- Empty messages
- Empty file paths
- Invalid menu choices
- Invalid encrypted messages
- Invalid encrypted files
- Missing files
The program checks whether the destination file already exists before writing to it to reduce the risk of accidental overwriting.
Encryption-Decryption-Tool/ │ ├── main.py ├── secret.key ├── .gitignore ├── README.md └── test.txt
Make sure Python 3 or later is installed.
Check the version:
python --version