Skip to content

michaalj/password-manager-cpp

Repository files navigation

Password Manager (CLI)

A command-line password manager written in C++23. It stores password entries in an encrypted local file using XOR-based cipher with a user-provided key, and supports automatic password generation, category management, and in-place editing.

Tech Stack

  • Language: C++23
  • Build system: CMake 3.24+
  • Dependencies: C++ Standard Library only (no external libraries)

Features

  • Create password entries with name, password, category, login, and service fields
  • Automatic password generation with configurable length, special characters, and letter case
  • Manual password entry
  • Category-based organization with bulk deletion when a category is removed
  • Search entries by name
  • Sort entries alphabetically by name, then by category
  • Edit any field of an existing entry
  • XOR encryption/decryption of the storage file with a user-provided key
  • Modification timestamps embedded in the encrypted file
  • File selection from the current working directory, with automatic creation of new files

Project Structure

.
├── CMakeLists.txt          # Build configuration
├── PasswordEntry.h         # Password entry data model (header)
├── PasswordEntry.cpp       # Password entry logic and user interaction
├── UserInterface.h         # Main UI controller (header)
├── UserInterface.cpp       # Menu system, file I/O, encryption, and entry point

Building

mkdir build && cd build
cmake ..
cmake --build .

Usage

Run the compiled executable. On startup, the program lists files in the current directory and prompts for a file path. If the file exists and contains encrypted data, it asks for the decryption key. If the file does not exist, it creates a new empty file.

Once loaded, the interactive menu provides the following options:

Option Action
1 Search passwords
2 Sort passwords
3 Add password
4 Edit password
5 Delete password
6 Add category
7 Remove category
8 Save file
9 Display all passwords
10 Show menu
11 Exit

Interactive prompts use T (yes) and N (no) for boolean choices during password generation.

Limitations

  • Encryption uses a simple XOR cipher, which is not cryptographically secure. This is a learning project and should not be used for real credential storage.
  • Password generation uses rand() without seeding, producing predictable sequences.
  • No input validation on file path (directory traversal is possible).
  • No duplicate entry detection.
  • The control text used for key verification is stored as a known plaintext constant, which weakens the encryption scheme.

This project was developed as part of the PJC (Programming in C++) course at Polish-Japanese Academy of Information Technology (PJATK).

About

CLI password manager with XOR encryption, auto-generation, and category management (C++23, CMake)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors