pub struct SrtpKeys {
pub local: (Vec<u8>, Vec<u8>),
pub remote: (Vec<u8>, Vec<u8>),
}Expand description
The master keys for one SRTP session, one direction each.
Separate directions because RFC 3711 keys them separately: each side offers its own key in SDP and uses the other’s to decrypt. Sharing one key between directions would give both ends the same keystream for the same packet index, which is the classic way to lose a stream cipher.
Fields§
§local: (Vec<u8>, Vec<u8>)Master key and salt this side encrypts with — the one offered in our SDP.
remote: (Vec<u8>, Vec<u8>)Master key and salt the far end encrypts with — the one from its SDP.
Implementations§
Source§impl SrtpKeys
impl SrtpKeys
Sourcepub fn from_answer(
offered: &[Crypto],
answered: Option<&Crypto>,
) -> Result<Self, SdpError>
pub fn from_answer( offered: &[Crypto], answered: Option<&Crypto>, ) -> Result<Self, SdpError>
The keys an SDES answer settled on, after checking it against what was offered
(RFC 4568 §5.1.3; docs/specs/srtp.md §5.4).
This is the seam between the signalling and the media path, and the reason it is fallible
rather than an Option: an answer that echoed a tag this side never sent has agreed to
nothing, and the two outcomes that are not an error are both worse than one. Returning
None would place the call unencrypted, so a user who asked for a secure call gets an
insecure one and nothing says so; dropping the stream would end the call with no reason
anyone can act on. The error carries which tag came back and why it was refused.
answered is None when the answer carried no a=crypto this side can perform — the
shape in which “a suite that was never offered” arrives, since
sipx_sdp::crypto::Crypto::parse refuses one sipx cannot key.
§Errors
sipx_sdp::SdpError::Invalid when the answer accepted a tag and suite pair that was
never offered, or carried no key. It never names key material.
Trait Implementations§
impl Eq for SrtpKeys
impl StructuralPartialEq for SrtpKeys
Auto Trait Implementations§
impl Freeze for SrtpKeys
impl RefUnwindSafe for SrtpKeys
impl Send for SrtpKeys
impl Sync for SrtpKeys
impl Unpin for SrtpKeys
impl UnsafeUnpin for SrtpKeys
impl UnwindSafe for SrtpKeys
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more