#encryption #vault #aes-gcm #gcm #aes

lockboxer

Configurable fork of Lockbox encryption library

2 unstable releases

0.2.0 Sep 4, 2025
0.1.0 Aug 30, 2025

#1301 in Cryptography

Download history 303/week @ 2025-08-30 801/week @ 2025-09-06 769/week @ 2025-09-13 476/week @ 2025-09-20 398/week @ 2025-09-27

2,563 downloads per month

MIT license

21KB
302 lines

Lockboxer

Build Status Crates.io Docs Dependencies

Lockboxer is a configurable fork of Lockbox Rust library that provides easy-to-use, secure, and efficient encryption and decryption using the AES-GCM (Galois/Counter Mode) algorithm.

It ensures data integrity and confidentiality while offering flexibility for various use cases.

Features

  • Simple and intuitive API for encrypting and decrypting data.
  • Support for customizable tags, Additional Authenticated Data (AAD), and Initialization Vectors (IV).
  • Secure default settings to avoid common cryptographic pitfalls.
  • Error handling with detailed, meaningful messages.

Installation

To use Lockboxer in your Rust project, add the following to your Cargo.toml:

[dependencies]
lockboxer = "0.2"

Getting Started

Here’s a quick example to get you started with Lockboxer:

use lockboxer::Vault;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Generate a random key
    // This is for demo purposes. In a real situation you'll want to
    // use a stable key.
    let key = lockboxer::generate_key();

    // Initialize a vault with the key
    let vault = Vault::new(&key);

    // Or with config options:
    let vault = Vault::new(&key)
        .with_tag("Custom.Tag.V1")
        .with_aad("Custom.AAD");

    // Encrypt some plaintext
    let plaintext = b"Hello, secure world!";
    let encrypted = vault.encrypt(plaintext)?;
    println!("Encrypted: {:?}", encrypted);

    // Decrypt the ciphertext
    let decrypted = vault.decrypt(&encrypted)?;
    println!("Decrypted: {}", String::from_utf8(decrypted)?);

    Ok(())
}

Dependencies

~1.3–1.8MB
~39K SLoC