Prf

Trait Prf 

Source
pub trait Prf: Send + Sync {
    // Required methods
    fn for_key_exchange(
        &self,
        output: &mut [u8; 48],
        kx: Box<dyn ActiveKeyExchange>,
        peer_pub_key: &[u8],
        label: &[u8],
        seed: &[u8],
    ) -> Result<(), Error>;
    fn new_secret(&self, master_secret: &[u8; 48]) -> Box<dyn PrfSecret>;

    // Provided method
    fn fips(&self) -> bool { ... }
}
Expand description

An instantiation of the TLS1.2 PRF with a specific, implicit hash function.

See the definition in RFC5246 section 5.

See PrfUsingHmac as a route to implementing this trait with just an implementation of hmac::Hmac.

Required Methods§

Source

fn for_key_exchange( &self, output: &mut [u8; 48], kx: Box<dyn ActiveKeyExchange>, peer_pub_key: &[u8], label: &[u8], seed: &[u8], ) -> Result<(), Error>

Computes PRF(secret, label, seed) using the secret from a completed key exchange.

Completes the given key exchange, and then uses the resulting shared secret to compute the PRF, writing the result into output.

The caller guarantees that label, seed are non-empty. The caller makes no guarantees about the contents of peer_pub_key. It must be validated by ActiveKeyExchange::complete.

Source

fn new_secret(&self, master_secret: &[u8; 48]) -> Box<dyn PrfSecret>

Returns an object that can compute PRF(secret, label, seed) with the same master_secret.

This object can amortize any preprocessing needed on master_secret over several PRF(...) calls.

Provided Methods§

Source

fn fips(&self) -> bool

Return true if this is backed by a FIPS-approved implementation.

Implementors§