| Crates.io | lockbox |
| lib.rs | lockbox |
| version | 0.1.0 |
| created_at | 2024-09-13 13:30:55.772343+00 |
| updated_at | 2024-09-13 13:30:55.772343+00 |
| description | Easy-to-use, secure, and efficient encryption and decryption using the AES-GCM (Galois/Counter Mode) algorithm. |
| homepage | https://github.com/scrogson/lockbox |
| repository | https://github.com/scrogson/lockbox |
| max_upload_size | |
| id | 1373660 |
| size | 20,689 |
Lockbox is a 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.
To use Lockbox in your Rust project, add the following to your Cargo.toml:
[dependencies]
lockbox = "0.1"
Here’s a quick example to get you started with Lockbox:
use lockbox::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 = lockbox::generate_key();
// Initialize a vault with the key and a tag
let vault = Vault::new(&key, "AES.GCM.V1");
// 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(())
}