Crate sealed_box

source ·
Expand description

§Sealed boxes for Rust/WebAssembly

This Rust crate provides libsodium sealed boxes for WebAssembly.


// Recipient: create a new key pair
let recipient_kp = sealed_box::KeyPair::create();

//  Sender: encrypt the message for the recipient whose public key is
let msg = b"test";
let ciphertext = sealed_box::seal(msg,;

// Recipient: decrypt the ciphertext using the key pair
let decrypted_msg = sealed_box::open(&ciphertext, &recipient_kp).unwrap();

assert_eq!(msg[..], decrypted_msg);

Compile with cargo wasix.




  • Number of additional bytes in a ciphertext compared to the corresponding plaintext


  • Decrypt a ciphertext ciphertext using the key pair kp
  • Encrypt a message msg for a peer whoose public key is peer_pk

Type Aliases§