Skip to main content

rtc_shared/crypto/
mod.rs

1use crate::error::Result;
2
3/// KeyingMaterialExporter to extract keying material.
4///
5/// This trait sits here to avoid getting a direct dependency between
6/// the dtls and srtp crates.
7pub trait KeyingMaterialExporter {
8    /// Derives keying material from the established session, per RFC 5705.
9    ///
10    /// `label` and `context` bind the derived key to a purpose — DTLS-SRTP uses the
11    /// `EXTRACTOR-dtls_srtp` label to obtain SRTP master keys and salts from a completed
12    /// DTLS handshake.
13    ///
14    /// # Errors
15    ///
16    /// Fails if the session has not completed its handshake, so no secret is available yet.
17    fn export_keying_material(&self, label: &str, context: &[u8], length: usize)
18    -> Result<Vec<u8>>;
19}