A simple yet secure Password Manager built in Python that allows users to store, encrypt, and retrieve passwords safely using the cryptography library.
This project focuses on data security, encryption, and authentication β providing a practical demonstration of secure credential management.
- π Secure Encryption β All passwords are encrypted using Fernet (symmetric encryption).
- π€ Master Password β Access to stored credentials is protected with a master key.
- πΎ Local Storage β Encrypted credentials are saved securely in a local file.
- π§© Add & View Mode β Easily add new credentials and retrieve stored ones.
β οΈ Error Handling β Handles invalid tokens, missing files, and incorrect decryption gracefully.- π§ Beginner-Friendly Code β Simple, readable, and modular structure for easy understanding.
- Language: Python 3
- Libraries:
cryptographyβ for encryption & decryptionosβ for file operationsgetpassβ for hidden master password input
- Key Generation
- The program generates a secure encryption key (
key.key) if it doesnβt exist.
- The program generates a secure encryption key (
- Master Password
- The key is used to encrypt/decrypt user passwords, acting as a βmaster key.β
- Add Mode
- User inputs the account name, username, and password β all are encrypted and saved to
passwords.txt.
- User inputs the account name, username, and password β all are encrypted and saved to
- View Mode
- Decrypts and displays stored credentials in a secure readable format.
pip install cryptography
2οΈβ£ Run the script
python passwordmanager.py
3οΈβ£ Choose an option
Would you like to add a new password or view existing ones?
(add/view) or q to quit
π File Structure
Password-Manager/
β
βββ passwordmanager.py # Main application file
βββ key.key # Encryption key file (auto-generated)
βββ passwords.txt # Encrypted password storage
βββ README.md # Documentation
βοΈ Example Output
Would you like to add a new password or view existing ones? (add/view) view
Enter master password:
---------------------------------
Website: Gmail
Username: sidrah123
Password: ********
---------------------------------
π§ Concepts Learned
Symmetric Encryption using cryptography.fernet
Secure key management
File I/O operations
Exception handling in Python
Designing command-line interfaces
π Future Enhancements
Integrate a password strength checker
Include a random password generator
Switch to SQLite database for storage
Add auto-lock and timeout functionality