Expand description
SRTP (Secure RTP) implementation per RFC 3711.
Provides AES-128-CM encryption with HMAC-SHA1-80 authentication for securing RTP and RTCP media streams using SDES key exchange (RFC 4568).
§Example
use rtp_engine::srtp::SrtpContext;
// Generate keying material
let (mut sender, key_material) = SrtpContext::generate().unwrap();
let mut receiver = SrtpContext::from_base64(&key_material).unwrap();
// Encrypt RTP packet
let rtp = vec![0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xA0,
0x12, 0x34, 0x56, 0x78, 0xDE, 0xAD, 0xBE, 0xEF];
let srtp = sender.protect_rtp(&rtp).unwrap();
// Decrypt on receiver side
let decrypted = receiver.unprotect_rtp(&srtp).unwrap();
assert_eq!(decrypted, rtp);Structs§
- Srtp
Context - SRTP cryptographic context for a single media session.
Constants§
- KEYING_
MATERIAL_ LEN - Total keying material length (master key + master salt).
Functions§
- build_
sdp_ crypto_ line - Build the
a=cryptoSDP attribute line. - parse_
sdp_ crypto - Parse an
a=cryptoattribute from SDP.