Skip to content

rushdv/encrypted-password-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Encrypted Password Manager

A secure command-line password manager built with Python. All passwords are encrypted using Fernet encryption, and the master password is hashed with SHA-256 for security.

Features

  • Master Password Protection: Set and authenticate with a master password (SHA-256 hashed).
  • Encrypted Storage: All passwords are encrypted using Fernet encryption.
  • Add Passwords: Store website credentials (Website, Username, Password).
  • View Passwords: Display all stored credentials in a formatted list.
  • Search Passwords: Find specific password entries by website name.
  • Secure Exit: Safe password management with proper error handling.
  • Data Persistence: Encrypted data stored locally (master.txt and vault.txt).

Prerequisites

  • Python 3.x
  • Required packages: cryptography

Installation

  1. Navigate to the project directory:

    cd encrypted-password-manager
  2. Install required dependencies:

    pip install cryptography

How to Use

Step 1: Run the Program

python main.py

Step 2: First Time Setup (Master Password)

On your first run, the program will ask you to set a Master Password:

Set master password: ••••••••
Confirm master password: ••••••••
Master password set successfully !
  • Enter a strong password (mix of uppercase, lowercase, numbers, symbols).
  • Confirm it by entering the same password again.
  • This master password will be used every time you run the program.

Step 3: Subsequent Runs (Authentication)

On every run after the first, you'll be asked to enter your master password:

Enter master password: ••••••••
  • You have 3 attempts to enter the correct password.
  • If you fail 3 times, the program will exit.
  • Enter the master password you set during first setup.

Step 4: Main Menu Options

After authentication, you'll see the main menu:

===== PASSWORD MANAGER =====
1. Add new password
2. View saved passwords
3. Search password
4. Exit
Choice option: 

Option 1: Add New Password

Choice option: 1
Website: github.com
Username: myemail@example.com
Password: ••••••••
Password saved securely!
  • Enter the website/service name (e.g., github.com, gmail.com).
  • Enter your username or email.
  • Enter your password (will be hidden as you type).
  • Password is encrypted and saved to vault.txt.

Option 2: View Saved Passwords

Choice option: 2
===== SAVED PASSWORDS =====
Website: github.com, Username: myemail@example.com, Password: mySecurePass123
Website: gmail.com, Username: user@gmail.com, Password: gmailPassword456
  • Displays all saved passwords in a readable format.
  • Passwords are decrypted automatically using your key.

Option 3: Search Password

Choice option: 3
Enter website to search: github
Website: github.com, Username: myemail@example.com, Password: mySecurePass123
  • Search for passwords by website name (case-insensitive).
  • Useful when you have many passwords stored.

Option 4: Exit

Choice option: 4
Exiting Password Manager....
  • Safely exits the program.

Security Features

  • 🔐 SHA-256 Hashing: Master password is hashed, never stored in plain text.
  • 🔒 Fernet Encryption: All stored passwords are encrypted with military-grade encryption.
  • 🔑 Automatic Key Generation: Encryption key is auto-generated on first run (key.key).
  • 🛡️ Three-Attempt Limit: Failed authentication attempts are limited to 3 tries.

File Structure

encrypted-password-manager/
├── main.py              # Main program file
├── master.txt           # Hashed master password (auto-created)
├── vault.txt            # Encrypted password entries (auto-created)
├── key.key              # Encryption key (auto-created)
└── README.md            # This file

Important Notes

⚠️ Backup Your Key!

  • The key.key file is essential. If lost, you cannot decrypt your passwords.
  • Keep a backup of key.key in a safe location.

⚠️ Master Password

  • Do not forget your master password. There is no recovery option.
  • If forgotten, delete master.txt to set a new one (but old passwords will still be encrypted with old key).

⚠️ Data Files

  • Keep master.txt, vault.txt, and key.key files safe.
  • These files contain sensitive data.

Example Workflow

  1. First Run:

    $ python main.py
    Set master password: MySecurePass123
    Confirm master password: MySecurePass123
    Master password set successfully !
    
    ===== PASSWORD MANAGER =====
    1. Add new password
    2. View saved passwords
    3. Search password
    4. Exit
    Choice option: 
    
  2. Add a Few Passwords:

    Choice option: 1
    Website: github.com
    Username: john@example.com
    Password: GitHubPass@123
    Password saved securely!
    
    Choice option: 1
    Website: gmail.com
    Username: john@gmail.com
    Password: GmailPass@456
    Password saved securely!
    
  3. View All Passwords:

    Choice option: 2
    ===== SAVED PASSWORDS =====
    Website: github.com, Username: john@example.com, Password: GitHubPass@123
    Website: gmail.com, Username: john@gmail.com, Password: GmailPass@456
    
  4. Search for a Password:

    Choice option: 3
    Enter website to search: github
    Website: github.com, Username: john@example.com, Password: GitHubPass@123
    
  5. Exit:

    Choice option: 4
    Exiting Password Manager....
    

Troubleshooting

Issue Solution
No module named 'cryptography' Run pip install cryptography
Wrong master password! 3 attempts left. Enter the correct master password
Too many failed attempts. Exiting... Restart the program and try again
No password saved yet. Add passwords using option 1 first
No matching entries found. Search with a different keyword

License

This project is open source and available under the MIT License.

About

A security-focused password manager demonstrating encryption, hashing, and secure file handling in Python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages