pub struct MasterKey { /* private fields */ }Expand description
A stream master key
Composed of the key, salt, an optional MKI and key life time
Implementations§
Source§impl MasterKey
impl MasterKey
Sourcepub fn new(key: &[u8], salt: &[u8], mki: &Option<Vec<u8>>) -> Self
pub fn new(key: &[u8], salt: &[u8], mki: &Option<Vec<u8>>) -> Self
create a stream master key
The key is created with default lifetime (2^48 for RTP, 2^31 for RTCP) and default soft limits (2^16 for both RTP and RTCP)
§Arguments
- key: the master key
- salt: the master salt, this field can be an empty slice, in that case the master salt is considered all 0.
- mki: optionnal master key id - see RFC 3711 - section 3.1
Sourcepub fn set_keys_lifetime(
&mut self,
rtp: u64,
rtp_limit: u64,
rtcp: u32,
rtcp_limit: u32,
) -> Result<(), SrtpError>
pub fn set_keys_lifetime( &mut self, rtp: u64, rtp_limit: u64, rtcp: u32, rtcp_limit: u32, ) -> Result<(), SrtpError>
Set the session keys lifetime and soft limit
§Arguments
- rtp : number of lives a session key gets on RTP stream. Must be <= 2^48
- rtp_limit : when the lives left is under this limit, raise an alert. Must be < rtp
- rtcp : number of lives a session key gets on RTCP stream. Must be <= 2^31
- rtcp_limit : when the lives left is under this limit, raise an alert. Must be < rtcp
§Returns one of:
- Ok
- InvalidProfile when the arguments don’t match the requirements
§Notes
-
When a master key is used by several streams (from a stream template):
- Each one will start with the same lifetime.
- The lifetime countdown is not shared on the master key but on each stream.
- When a stream reaches it’s end of life, all the other streams derived from the master key are killed.
-
When a stream reaches the end of one of its key(RTP/RTCP) lifetime, it is disabled for both types.
-
For streams using mki, when the soft or hard limit is reached it applies to one master key, the stream can keep going using others mki after one is dead.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MasterKey
impl RefUnwindSafe for MasterKey
impl Send for MasterKey
impl Sync for MasterKey
impl Unpin for MasterKey
impl UnwindSafe for MasterKey
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