LockBox

LockBox is an encrypted file container that allows you to securely store files and directories in a single password-protected file. It provides a virtual filesystem where all contentsβ€”including filenames, directory structures, and file dataβ€”are encrypted using the SPHINX cipher.

Features

Quick Start

Installation

Building from Source

# Clone the repository
git clone https://github.com/yourusername/LockBox.git
cd LockBox

# Create build directory
mkdir build && cd build

# Configure and build
cmake ..
make -j$(nproc)

# Run tests (optional)
cmake -DBUILD_TESTS=ON ..
make LockBoxTests
./LockBoxTests

Requirements

Interactive Mode

Running LockBox without arguments opens the main menu:

./LockBox
+==========================================+
|          LOCKBOX - Main Menu             |
+==========================================+

  [1] Open LockBox
  [2] Create LockBox
  [3] Encrypt text
  [4] Decrypt text
  [0] Exit

>>

Creating a LockBox

# Interactive mode - follow the prompts
./LockBox
# Select option [2] Create LockBox

# Or command-line mode
./LockBox /path/to/folder output.lb "yourpassword"

Opening a LockBox

# Interactive mode
./LockBox
# Select option [1] Open LockBox

# Command-line extraction
./LockBox -e archive.lb /destination "yourpassword"

Command Line Usage

Basic Commands

# Create a LockBox from a folder
./LockBox /path/to/folder output.lb "mypassword"

# Extract entire LockBox
./LockBox -e archive.lb /destination "mypassword"

# Encrypt text (outputs hex)
./LockBox -c "secret text" "password"

# Decrypt text (hex input)
./LockBox -d "a1b2c3d4e5f6..." "password"

# Encrypt a file (raw binary output)
./LockBox -cf input.txt output.enc "password"

# Decrypt a file (raw binary output)
./LockBox -df output.enc decrypted.txt "password"

# Show help
./LockBox -h

Command-Line Arguments Summary

Arguments Description
<src> <lockbox> <pass> Create LockBox from file/folder
-e <lockbox> <dest> <pass> Extract LockBox to destination
-c <text> <password> Encrypt text to hex
-d <hex> <password> Decrypt hex to text
-cf <input> <output> <pass> Encrypt file (raw output)
-df <input> <output> <pass> Decrypt file (raw output)
-h Show help

CLI Mode

Once a LockBox is opened, CLI mode provides a Unix-like shell interface:

lockbox:/$ ls
  πŸ“ documents/
  πŸ“ images/
  πŸ“„ config.json (2.4 KB)
Total: 3 items

lockbox:/documents$ cat report.txt
This is the content of my encrypted file...

lockbox:/documents$ cd ..
lockbox:/$ tree
/
β”œβ”€β”€ πŸ“ documents/
β”‚   β”œβ”€β”€ πŸ“„ report.txt
β”‚   └── πŸ“„ notes.txt
β”œβ”€β”€ πŸ“ images/
β”‚   └── πŸ“„ photo.jpg
└── πŸ“„ config.json

lockbox:/$ exit

Available Commands

Command Syntax Description
ls ls [path] List directory contents
cd cd <path> Change directory
pwd pwd Print working directory
cat cat <file> Display file contents
mkdir mkdir <path> Create directory
rm rm <path> Remove file/directory
mv mv <src> <dst> Move or rename
cp cp <src> <dst> Copy file/directory
rename rename <path> <newname> Rename item
find find <pattern> Search by name
tree tree [path] Display tree structure
add add <file> [path] Import from filesystem
extract extract [src] <dst> Export to filesystem
info info <path> Show detailed information
limit limit [n] Set max items displayed
clear clear Clear screen
help help [cmd] Show help
exit exit Return to menu

Interactive Features

Management Menu

After opening a LockBox, the management menu provides:

Option Function
Extract Export all or part of the contents to the filesystem
CLI Mode Access the interactive shell for file operations
Search Search files by name pattern
Defragment Compact the file, reclaiming space from deleted items
View Log Display encrypted operation log
Clear Log Clear the activity log
Save & Exit Save changes and exit

Defragmentation

Over time, deleting files leaves unused space in the container. Defragmentation:

Activity Log

LockBox maintains an encrypted log of operations:

Security

Password Recommendations

  1. Minimum 16 characters (20+ recommended)
  2. Mix character types: uppercase, lowercase, numbers, symbols
  3. Avoid dictionary words or personal information
  4. Use a password manager to generate and store strong passwords
  5. Never share passwords over unencrypted channels

Encryption Details

LockBox uses the SPHINX cipher, a modern wide-block encryption algorithm:

Default configuration provides 256-bit security (16 blocks Γ— 16-bit words).

What Gets Encrypted

βœ… File contents
βœ… File names
βœ… Directory names
βœ… Directory structure (via encrypted pointers)
βœ… Timestamps
βœ… Activity log

The only unencrypted data is the raw container file size (which reveals approximate storage usage).

Architecture Overview

LockBox consists of three main layers:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         APPLICATION LAYER           β”‚
β”‚    (Interactive UI, CLI Parser)     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      VIRTUAL FILESYSTEM (iNode)     β”‚
β”‚   (Tree structure, file operations) β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      ENCRYPTION ENGINE (OpenES)     β”‚
β”‚      (SPHINX cipher, key mgmt)      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      PLATFORM ABSTRACTION LAYER     β”‚
β”‚   (File I/O, memory mapping)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

For detailed technical documentation, see doc/architecture.md.

Best Practices

Creating Secure LockBoxes

  1. Use strong, unique passwords for each LockBox
  2. Keep backups of your LockBox file in multiple locations
  3. Verify extraction before deleting original files
  4. Run defragment periodically to reclaim space
  5. Use CLI mode for batch operations (faster than individual commands)

Managing Large Archives

  1. Create directories first, then add files
  2. Use bulk add for importing folders (more efficient)
  3. Run defragment after major deletions
  4. Consider splitting very large archives (>10GB)

Security Hygiene

  1. Clear shell history after using command-line passwords:
    history -c  # Bash
    Clear-History  # PowerShell
    
  2. Use interactive mode when possible (password not in shell history)
  3. Secure erase deleted LockBox files (use shred on Linux)
  4. Never reuse passwords across different LockBoxes

Troubleshooting

Common Issues

β€œFailed to open LockBox”

β€œOut of memory” during defragment

β€œPermission denied”

Slow performance

Building Issues

CMake version too old

# Ubuntu/Debian
sudo apt update && sudo apt install cmake

# macOS
brew install cmake

Compiler doesn’t support C++23

Getting Help

  1. Check doc/architecture.md for technical details
  2. Review doc/oes.md for SPHINX cipher specification
  3. Run tests: ./LockBoxTests (if built with -DBUILD_TESTS=ON)

Security Considerations

Threats Addressed

Threat Mitigation
Unauthorized access Strong encryption, password required
Known-plaintext attacks Wide-block cipher with full diffusion
Side-channel attacks Constant-time operations, no lookups
Memory dumps Secure zeroing of keys
File carving No predictable headers or magic numbers

Limitations

Performance

Typical performance on modern hardware:

Operation Speed
Encryption ~50-100 MB/s
Decryption ~50-100 MB/s
File listing <100ms for 1000 files
Defragment ~10-20 MB/s

Actual performance depends on hardware, block size configuration, and data patterns.

Contributing

Contributions are welcome! Areas for improvement:

See source code documentation in doc/architecture.md.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments


Note: This software is provided as-is without warranty. Always maintain backups of important data.