Skip to content

jclifford4/SecurePasswordManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

103 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secure Password Manager

A secure way to manage passwords on a local machine.


About

General Information

Passwords

Plaintext passwords are never saved.

Account Passwords (master password) : are hashed and salted then are stored to the localdatabase only accessible by that user.

Service Passwords : are symmetrically encrypted and are stored in the local database. They can only be decrpyted by confirming the master password of the user account.

Storage, Hashing, & Encryption

This program uses MySQL server and MySQL Shell to store hashed and encrypted sensitive data only.

  • Hashed + salted master passwords are stored for each user. These are needed to unlock service passwords.
    • 100k iterations using PBKDF2
    • PBKDF2 applies a pseudorandom function like HMAC to the input password and applies a salt iteratively.
    • PBKDF2 & HMAC.
  • Encrpted service passwords are stored and can only be decrypted thorugh use of correct user master password.
    • User generates a 32byte key converted to base64 string that acts as the symmetrical key for Encrypting & Decrypting.
    • User can generate a new key if needed, all service passwords that used the old key will need to be updated.
    • If old key is removed or lost, all service passwords will unable to be decrypted to their original form.

Installation

Details
Windows Guide

Reminder : Any code snipped surrounded by {} will need your information.

Download the latest Release.

Unzip files into desired location.


Install Windows Terminal

  • It can be found in microsoft store for free if you search Windows Terminal.
  • Open Terminal and set it as default Terminal in settings.
  • (Optional) Change background color to a brighter/different theme for better readablility.

Run SPM.exe

  • type keygen and copy the generated hash.
  • type q to quit the program.

Configure .my.cnf file

  • Go to the scripts directory.
  • Open .my.cnf file.
  • Paste your key from keygen command after Encryption=.
  • Enter a database name that will be used later.
  • Save the file and close it.
  • Open Powershell where .my.cnf is located.
    • This can be done by shift + rclick within the folder, select open Powershell window here.
  • Encrypt the file :
cipher /e .\.my.cnf

Install MySQL Community 8.0.37 or higher


Open MysqlShell :

  • make sure you are in JS mode type \js
Connect with root :
  • password was created on install
\connect root@localhost
Change to sql mode :
\sql
Create a new user :
CREATE USER '{your_username}'@'%' IDENTIFIED BY '{your_password}';
Grant and Flush privileges :
GRANT ALL PRIVILEGES ON *.* TO '{your_username}'@'%';
FLUSH PRIVILEGES;
\disconnect
Connect with your user :
\connect {your_username}@localhost

Create a new Database :

CREATE DATABASE {your_database_name};

Verify new database exists :

SHOW DATABASES;

Connect to new database :

USE {your_database_name};

Create users table :

CREATE TABLE `users` (
  `userID` int NOT NULL AUTO_INCREMENT,
  `userName` varchar(25) NOT NULL,
  `passwordHash` varchar(84) NOT NULL,
  `creationDate` datetime DEFAULT NULL,
  `guid` varchar(36) NOT NULL,
  PRIMARY KEY (`userID`),
  UNIQUE KEY `userID_UNIQUE` (`userID`),
  UNIQUE KEY `userName_UNIQUE` (`userName`),
  UNIQUE KEY `guid_UNIQUE` (`guid`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

Create services table :

CREATE TABLE `services` (
    `passID` int NOT NULL AUTO_INCREMENT,
    `userID` int NOT NULL,
    `service` varchar(25) NOT NULL,
    `encryptedPassword` varchar(128) NOT NULL,
    `guid` varchar(36) NOT NULL,
    `creationDate` datetime NOT NULL,
    PRIMARY KEY (`passID`),
    UNIQUE KEY `passID_UNIQUE` (`passID`),
    UNIQUE KEY `guid_UNIQUE` (`guid`),
    KEY `userID` (`userID`),
    CONSTRAINT `userID` FOREIGN KEY (`userID`) REFERENCES `users` (`userID`) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

Verify tables were created :

SHOW TABLES;

Configure .my.cnf :

  • Open /scripts/.my.cnf
  • Edit in your database name if you haven't already.
  • Edit in a location for database backups.
    • Preferably in /backups folder.
  • Edit where you want to save database backup files.
  • Save the file and close it.

Configuration mylogin.cnf :

  • Go to mysql installation files, usually found in :
C:\Program Files\MySQL\MySQL Server 8.0\bin\
  • Open Terminal in the bin directory and paste with your database username :
./mysql_config_editor set --login-path=client --host=localhost --user={your_username} --password
  • file is saved in: C:\Users{your_username}\AppData\Roaming\MySQL.mylogin.cnf

Add Environment Variables :

  • Add MYSQL_COMMANDS with path {path\to\mysqlserver\bin\}
  • Add POWERSHELL with path C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe

About

A local password vault made with C# and MySQL.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors