Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Outline

SodiumBox

A pure Rust implementation of libsodium's sealed box encryption, compatible with libsodium/sodiumoxide but without any C dependencies.

Overview

SodiumBox provides a standalone implementation of the sealed box functionality from libsodium (NaCl) using only pure Rust cryptographic libraries. It is designed to be a drop-in replacement for sodiumoxide's sealed box functionality.

The implementation uses modern, well-maintained Rust cryptographic libraries:

  • x25519-dalek for Curve25519 key exchange
  • xsalsa20poly1305 for authenticated encryption
  • blake2 for key derivation
  • salsa20 for the HSalsa20 function

Features

  • Generate X25519 keypairs for sealed box operations
  • Seal messages using a recipient's public key
  • Open sealed boxes created by libsodium/sodiumoxide
  • Pure Rust implementation with no C dependencies
  • Comprehensive test vectors based on libsodium's test suite

Usage

use sodiumbox::{generate_keypair, seal, open_sealed_box};

// Generate a new keypair
let (public_key, secret_key) = generate_keypair();

// Create a message to encrypt
let message = b"This is a secret message";

// Seal the message for the recipient
let sealed_box = seal(message, &public_key);

// Open a sealed box
let result = open_sealed_box(&sealed_box, &public_key, &secret_key);
match result {
    Ok(plaintext) => println!("Decrypted message: {:?}", plaintext),
    Err(_) => println!("Failed to decrypt"),
}

License

This crate is licensed under either of:

at your option.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.