Skip to content

A simple command-line tool to securely create and retrieve encrypted text entries (like diary entries). Each entry is AES-GCM encrypted using a password and saved as a .json file, ensuring confidentiality and integrity

Notifications You must be signed in to change notification settings

srtk-Negi/CryptDiary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📝 SecureDiary CLI

SecureDiary is a simple command-line tool to securely create and retrieve encrypted text entries (like diary entries). Each entry is AES-GCM encrypted using a password and saved as a .json file, ensuring confidentiality and integrity.

🔐 Features

  • Create password-protected encrypted text entries
  • Optionally import from .txt files
  • Retrieve and decrypt entries interactively
  • Secure AES-GCM encryption using a key derived from your password (PBKDF2)
  • Simple config file to set a persistent save directory

🛠 Installation

  1. Clone this repository or copy enc.py and place it in your project directory.
  2. Install the required Python package:
pip install cryptography

or

pip install -r requirements.txt
  1. Create a config file in the same directory named .tool_config.json with the following content:
{
  "entries_dir": ""
}

This will be updated automatically when you set the save directory.


🚀 Usage

1. Set or update save directory

python3 enc.py --savedir /path/to/your/entries

This updates the save path in .tool_config.json.


2. Make a new encrypted entry

Option 1: Type interactively

python3 enc.py --make_entry

You will be prompted to enter:

  • A password
  • The content of your entry
  • A filename (or press enter to use timestamp)

Option 2: Import from .txt file

python3 enc.py --make_entry --file your_text_file.txt

3. Retrieve and decrypt an entry

python3 enc.py --get_entry

This will:

  • List all saved entries
  • Prompt you to select one
  • Ask for the password
  • Decrypt and display the entry

📂 File Structure

  • enc.py: Main CLI script
  • .tool_config.json: Stores the directory path to save encrypted entries
  • your_entries/: Directory where encrypted .json files are stored

Each entry file contains:

{
  "salt": "...",
  "nonce": "...",
  "ciphertext": "...",
  "tag": "..."
}

⚠️ Security Notes

  • Encryption is done using AES-GCM with 256-bit key.
  • Keys are derived using PBKDF2 with SHA-256 and 480,000 iterations.
  • If you forget the password for an entry, it cannot be recovered.
  • Keep .tool_config.json and your entries directory safe and secure.

📌 Requirements

  • Python 3.7+
  • cryptography package

📄 License

MIT License — feel free to use, modify, and distribute.

About

A simple command-line tool to securely create and retrieve encrypted text entries (like diary entries). Each entry is AES-GCM encrypted using a password and saved as a .json file, ensuring confidentiality and integrity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages