Skip to main content

KeyExchange

Trait KeyExchange 

Source
pub trait KeyExchange: Send {
    // Required methods
    fn generate(&mut self) -> Vec<u8> ;
    fn compute_shared_secret(&self, peer_public: &[u8]) -> Option<Vec<u8>>;
    fn group_id(&self) -> u16;
}
Expand description

Key exchange group trait.

Required Methods§

Source

fn generate(&mut self) -> Vec<u8>

Generate an ephemeral keypair. Returns the public key bytes to send in KeyShare/ClientKeyExchange.

Source

fn compute_shared_secret(&self, peer_public: &[u8]) -> Option<Vec<u8>>

Compute the shared secret from the peer’s public key. Returns None if the peer’s key is invalid.

Source

fn group_id(&self) -> u16

Get the named group ID for this key exchange.

Implementors§