rustls::crypto

Trait ActiveKeyExchange

source
pub trait ActiveKeyExchange: Send + Sync {
    // Required methods
    fn complete(
        self: Box<Self>,
        peer_pub_key: &[u8],
    ) -> Result<SharedSecret, Error>;
    fn pub_key(&self) -> &[u8] ;
    fn group(&self) -> NamedGroup;
}
Expand description

An in-progress key exchange originating from a SupportedKxGroup.

Required Methods§

source

fn complete(self: Box<Self>, peer_pub_key: &[u8]) -> Result<SharedSecret, Error>

Completes the key exchange, given the peer’s public key.

This method must return an error if peer_pub_key is invalid: either mis-encoded, or an invalid public key (such as, but not limited to, being in a small order subgroup).

The shared secret is returned as a SharedSecret which can be constructed from a &[u8].

This consumes and so terminates the ActiveKeyExchange.

source

fn pub_key(&self) -> &[u8]

Return the public key being used.

The encoding required is defined in RFC8446 section 4.2.8.2.

source

fn group(&self) -> NamedGroup

Return the group being used.

Implementors§