Skip to main content

establish

Function establish 

Source
pub fn establish<H: Handshake>(
    handshake: &mut H,
    role: Role,
    peer_fingerprint: Option<&Fingerprint>,
) -> Result<Keys, Error>
Expand description

Handshake, verify the peer against the fingerprint from its SDP, and derive the SRTP keys.

The order is the point. RFC 8122 §6.2 requires an endpoint whose peer’s certificate does not match the fingerprint to “terminate the media connection with a bad_certificate error” — so the check happens before any keys are handed back, and a mismatch returns an error rather than a pair of contexts a caller might use anyway.