Crate msf_srtp

Crate msf_srtp 

Source
Expand description

This crate implements DTLS-SRTP as defined in RFC 5764. The RFC is built on top of:

  • RFC 3711 (SRTP)
  • RFC 4347 (DTLS)
  • RFC 8122 (TLS in SDP)

§Usage example

use openssl::{pkey::PKey, rsa::Rsa};

// a UDP stream + sink
let stream = ...;

// peer certificate fingerprint from SDP
let cert_fingerprint = "...";

// peer setup attribute from SDP
let setup = "...";

let connect = match setup {
    "active" | "actpass" => true,
    "passive" => false,
    _ => panic!("unsupported setup"),
};

// generate a private key (can be application-wide)
let rsa = Rsa::generate(2048)?;
let key = PKey::from_rsa(rsa)?;

let context = SrtpContext::self_signed(&key)?;

let stream = if connect {
    context.connect_muxed(stream, cert_fingerprint).await?
} else {
    context.accept_muxed(stream, cert_fingerprint).await?
};

Structs§

CertificateFingerprint
Certificate fingerprint.
Error
SRTP error.
MuxedSrtpStream
Muxed SRTP-SRTCP stream.
RtpTransceiverOptions
RTP transceiver options.
SSRC2ClockRate
SSRC to clock rate mapping.
SrtcpStream
SRTCP stream.
SrtpContext
SRTP context.
SrtpContextBuilder
SRTP context builder.
SrtpStream
SRTP stream.
UnknownHashFunction
Unknown hash function.

Enums§

HashFunction
Hash function.
InvalidFingerprint
Invalid fingerprint.
SSRCMode
SSRC handling mode.
SrtpProfileId
SRTP profile ID.

Traits§

RtpTransceiver
RTP packet transceiver.