This Python script allows you to encrypt and decrypt passwords using the Fernet encryption algorithm and store them securely.
- Python 3
- cryptography library
You can install the required library using pip:
pip install cryptography-
Generate Key: Run the script to generate a key file (
key.key) required for encryption and decryption. If the key file already exists, this step is skipped. -
Encrypt and Save Password: Choose option 1 to enter a username and password. The password will be encrypted using the generated key and saved to the
user_data.txtfile. -
Decrypt Password: Choose option 2 to enter a username. The script will retrieve the corresponding encrypted password from the
user_data.txtfile, decrypt it using the key, and display the decrypted password. -
Exit: Choose option 3 to exit the script.
password_encrypt_decrypt.py: The main Python script containing functions for generating, loading, encrypting, and decrypting passwords.key.key: The key file required for encryption and decryption.user_data.txt: The file where encrypted usernames and passwords are stored.
- Ensure that you keep the
key.keyfile secure. Without it, you won't be able to decrypt the passwords. - The script uses Fernet encryption, which provides secure encryption and decryption of passwords. However, it's essential to follow best practices for password management and storage.
This project is licensed under the MIT License.