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§
- Certificate
Fingerprint - Certificate fingerprint.
- Error
- SRTP error.
- Muxed
Srtp Stream - Muxed SRTP-SRTCP stream.
- RtpTransceiver
Options - RTP transceiver options.
- SSRC2
Clock Rate - SSRC to clock rate mapping.
- Srtcp
Stream - SRTCP stream.
- Srtp
Context - SRTP context.
- Srtp
Context Builder - SRTP context builder.
- Srtp
Stream - SRTP stream.
- Unknown
Hash Function - Unknown hash function.
Enums§
- Hash
Function - Hash function.
- Invalid
Fingerprint - Invalid fingerprint.
- SSRC
Mode - SSRC handling mode.
- Srtp
Profile Id - SRTP profile ID.
Traits§
- RtpTransceiver
- RTP packet transceiver.