#[non_exhaustive]pub enum Spec<'a> {
Hkdf {
algorithm: KdfAlgorithm,
salt: Option<&'a [u8]>,
info: &'a [u8],
},
OneStep {
algorithm: KdfAlgorithm,
fixed_info: &'a [u8],
},
Dhkem {
algorithm: KdfAlgorithm,
},
}Expand description
A key derivation: the KDF and every input but the secret.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Hkdf
RFC 5869 HKDF (SP 800-56C Rev. 2 §5) in one call: extract, then expand. The pseudorandom
key never leaves the module. salt None or empty is RFC 5869’s default, HashLen zero
bytes. salt and info are treated as non-secret: the module’s binding copies them without
wiping. info binds the key to its use: a purpose label, the parties’ identifiers, the
public keys each contributed.
Fields
algorithm: KdfAlgorithmAn HKDF algorithm.
OneStep
The one-step KDF of SP 800-56C Rev. 2 §4.1 with a hash (option 1): H(counter || secret || fixed_info) for each 32-bit big-endian counter from 1, truncated to the output length. The
RFC 7518 Concat KDF is this function. fixed_info is §4.1’s FixedInfo, context-specific
data the caller encodes; it binds the key to its use, as info does for HKDF. The crate
treats it as non-secret.
Dhkem
RFC 9180 §4.1 DHKEM ExtractAndExpand over an ECDH shared secret, with kem_context =
the ephemeral public key ‖ the static public key and an output of Nsecret bytes, the
hash’s length. Valid only in ecdh’s agree, which holds the keys; algorithm must be
the HKDF that RFC 9180 §7.1 Table 2 pairs with the curve.
Fields
algorithm: KdfAlgorithmThe curve’s DHKEM HKDF.