oqs-safe 0.4.1

Safe Rust wrapper over libOQS for ML-KEM and ML-DSA with mock fallback.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use x25519_dalek::{PublicKey, StaticSecret};

pub fn x25519_keypair() -> (PublicKey, StaticSecret) {
    let sk = StaticSecret::random_from_rng(rand_core::OsRng);
    let pk = PublicKey::from(&sk);
    (pk, sk)
}

pub fn x25519_shared_secret(
    sk: &StaticSecret,
    pk: &PublicKey,
) -> [u8; 32] {
    sk.diffie_hellman(pk).to_bytes()
}