Skip to content

Struct crypto::SecretKey

zaun_community_protocol::crypto::SecretKey · Struct

pub struct SecretKey { … }

A suite-1 composite private key: mldsaSeed (FIPS 204 ξ, 32 B) ‖ edSK (32 B).

Never on the wire. Debug is redacted and the bytes are zeroized on drop. Its component keys are used only inside this composite (RFC 10073 the protocol).

The ML-DSA-65 expanded signing key is derived from the seed once, on first use, and kept with the key (it is zeroized on drop too): deriving it is about a fifth of the cost of a signature, and a host signs a session proof for every session.hello.

pub fn generate() -> Result<Self, RngError>

A fresh key from the OS CSPRNG.

RngError when getrandom fails.

pub fn from_bytes(bytes: &[u8; 64]) -> Self

Wraps the 64-byte encoding. The caller zeroizes its own copy.

pub const fn expose_secret(&self) -> &[u8; 64]

The 64-byte encoding, for sealed storage only.

pub fn public_key(&self) -> PublicKey

The composite public key: suite 0x01 ‖ mldsaPK ‖ edPK.

Clone, Debug, Drop, Zeroize, ZeroizeOnDrop

Full rustdoc page