pub struct MessageIntegrity<'a> { /* private fields */ }Expand description
The MESSAGE-INTEGRITY key: an HMAC-SHA1 is computed over the message with it.
Built from a short-term password, or from a long-term username/realm/password triple.
Implementations§
Source§impl<'a> MessageIntegrity<'a>
impl<'a> MessageIntegrity<'a>
Sourcepub fn new_raw_integrity_with_provider(
key: impl Into<Vec<u8>>,
crypto: &'a dyn RTCCrypto,
) -> Self
pub fn new_raw_integrity_with_provider( key: impl Into<Vec<u8>>, crypto: &'a dyn RTCCrypto, ) -> Self
Creates a raw-key integrity attribute with an explicit crypto provider.
Sourcepub fn new_short_term_integrity_with_provider(
password: String,
crypto: &'a dyn RTCCrypto,
) -> Self
pub fn new_short_term_integrity_with_provider( password: String, crypto: &'a dyn RTCCrypto, ) -> Self
Creates a short-term integrity attribute with an explicit crypto provider.
The password’s bytes are the key as they are: it must already be OpaqueString-processed
(RFC 8489 section 9.1.1). That holds for every ICE password, which is ASCII by its
grammar; for a password of any other origin use short_term.
Sourcepub fn short_term(password: &str, crypto: &'a dyn RTCCrypto) -> Result<Self>
pub fn short_term(password: &str, crypto: &'a dyn RTCCrypto) -> Result<Self>
Creates a short-term integrity attribute: key = OpaqueString(password) (RFC 8489
section 9.1.1).
§Errors
Fails for a password OpaqueString does not allow (RFC 8265 section 4.2).
Sourcepub fn new_long_term_integrity_with_provider(
username: String,
realm: String,
password: String,
crypto: &'a dyn RTCCrypto,
) -> Result<Self>
pub fn new_long_term_integrity_with_provider( username: String, realm: String, password: String, crypto: &'a dyn RTCCrypto, ) -> Result<Self>
Creates a long-term integrity attribute with an explicit crypto provider, with the MD5 key of RFC 8489 section 9.2.2 (realm and password OpaqueString-processed).
Sourcepub fn long_term_integrity_key(
username: String,
realm: String,
password: String,
crypto: &'a dyn RTCCrypto,
) -> Result<Vec<u8>>
pub fn long_term_integrity_key( username: String, realm: String, password: String, crypto: &'a dyn RTCCrypto, ) -> Result<Vec<u8>>
Creates a long-term integrity key with an explicit crypto provider: the MD5 key of RFC
8489 section 9.2.2. long_term_key takes the password algorithm.
Sourcepub fn check(m: &mut Message, key: &[u8], crypto: &dyn RTCCrypto) -> Result<()>
pub fn check(m: &mut Message, key: &[u8], crypto: &dyn RTCCrypto) -> Result<()>
Check checks MESSAGE-INTEGRITY attribute: the first one in m, over the message up to
it. Attributes after it are not covered, whatever they are.
A receiver that goes on to read the message uses
Validator instead, which runs this check and then
exposes only the attributes it covers (RFC 8489 section 9).
CPU costly, see BenchmarkMessageIntegrity_Check.