pub struct SrtpContext { /* private fields */ }Expand description
SRTP cryptographic context for a single media session.
Maintains session keys and rollover counter for sequence number tracking.
Implementations§
Source§impl SrtpContext
impl SrtpContext
Sourcepub fn new(master_key: &[u8], master_salt: &[u8]) -> Result<Self>
pub fn new(master_key: &[u8], master_salt: &[u8]) -> Result<Self>
Create a new SRTP context from master key and master salt.
The master key must be 16 bytes and master salt must be 14 bytes (AES_CM_128_HMAC_SHA1_80 profile).
Sourcepub fn from_base64(b64_key_material: &str) -> Result<Self>
pub fn from_base64(b64_key_material: &str) -> Result<Self>
Create from base64-encoded keying material (as used in SDP a=crypto).
Sourcepub fn generate() -> Result<(Self, String)>
pub fn generate() -> Result<(Self, String)>
Generate random keying material and return (context, base64-key).
Sourcepub fn protect_rtp(&mut self, rtp_packet: &[u8]) -> Result<Vec<u8>>
pub fn protect_rtp(&mut self, rtp_packet: &[u8]) -> Result<Vec<u8>>
Encrypt and authenticate an RTP packet.
Sourcepub fn unprotect_rtp(&mut self, srtp_packet: &[u8]) -> Result<Vec<u8>>
pub fn unprotect_rtp(&mut self, srtp_packet: &[u8]) -> Result<Vec<u8>>
Verify and decrypt an SRTP packet.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SrtpContext
impl RefUnwindSafe for SrtpContext
impl Send for SrtpContext
impl Sync for SrtpContext
impl Unpin for SrtpContext
impl UnsafeUnpin for SrtpContext
impl UnwindSafe for SrtpContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more