Module ies

Module ies 

Source
Expand description

Integrated Encryption Scheme (IES) utilities.

This module combines elliptic-curve Diffie–Hellman (ECDH) key agreement with authenticated encryption (AEAD) to provide sealed boxes that offer confidentiality and integrity for messages. It exposes a simple API via SealingKey, UnsealingKey, SealedMessage, and IesError.

§Examples

use miden_crypto::{
    dsa::eddsa_25519::SecretKey,
    ies::{SealingKey, UnsealingKey},
};
use rand::rng;

let mut rng = rng();
let secret_key = SecretKey::with_rng(&mut rng);
let public_key = secret_key.public_key();

let sealing_key = SealingKey::X25519XChaCha20Poly1305(public_key);
let unsealing_key = UnsealingKey::X25519XChaCha20Poly1305(secret_key);

let sealed = sealing_key.seal_bytes(&mut rng, b"hello world").unwrap();
let opened = unsealing_key.unseal_bytes(sealed).unwrap();

assert_eq!(opened.as_slice(), b"hello world");

Structs§

SealedMessage
A sealed message containing encrypted data

Enums§

IesError
Error type for the Integrated Encryption Scheme (IES)
SealingKey
Public key for sealing messages to a recipient.
UnsealingKey
Secret key for unsealing messages.