pub struct KeyConfig { /* private fields */ }Expand description
The key configuration of a server. This can be used by both client and server. An important invariant of this structure is that it does not include any combination of KEM, KDF, and AEAD that is not supported.
Implementations§
Source§impl KeyConfig
impl KeyConfig
Sourcepub fn new(
key_id: u8,
kem: Kem,
symmetric: Vec<SymmetricSuite>,
) -> Result<Self, Error>
pub fn new( key_id: u8, kem: Kem, symmetric: Vec<SymmetricSuite>, ) -> Result<Self, Error>
Construct a configuration for the server side.
§Panics
If the configurations don’t include a supported configuration.
Sourcepub fn derive(
key_id: u8,
kem: Kem,
symmetric: Vec<SymmetricSuite>,
ikm: &[u8],
) -> Result<Self, Error>
pub fn derive( key_id: u8, kem: Kem, symmetric: Vec<SymmetricSuite>, ikm: &[u8], ) -> Result<Self, Error>
Derive a configuration for the server side from input keying material,
using the DeriveKeyPair functionality of the HPKE KEM defined here:
https://www.ietf.org/archive/id/draft-irtf-cfrg-hpke-12.html#section-4
§Panics
If the configurations don’t include a supported configuration.
Sourcepub fn encode(&self) -> Result<Vec<u8>, Error>
pub fn encode(&self) -> Result<Vec<u8>, Error>
Encode into a wire format. This shares a format with the core of ECH:
opaque HpkePublicKey[Npk];
uint16 HpkeKemId; // Defined in I-D.irtf-cfrg-hpke
uint16 HpkeKdfId; // Defined in I-D.irtf-cfrg-hpke
uint16 HpkeAeadId; // Defined in I-D.irtf-cfrg-hpke
struct {
HpkeKdfId kdf_id;
HpkeAeadId aead_id;
} ECHCipherSuite;
struct {
uint8 key_id;
HpkeKemId kem_id;
HpkePublicKey public_key;
ECHCipherSuite cipher_suites<4..2^16-4>;
} ECHKeyConfig;§Panics
Not as a result of this function.
Sourcepub fn decode(encoded_config: &[u8]) -> Result<Self, Error>
pub fn decode(encoded_config: &[u8]) -> Result<Self, Error>
Construct a configuration from the encoded server configuration.
The format of encoded_config is the output of Self::encode.