webrtc_srtp/
protection_profile.rs1#[derive(Default, Debug, Clone, Copy)]
3#[repr(u8)]
4pub enum ProtectionProfile {
5 #[default]
6 Aes128CmHmacSha1_80 = 0x0001,
7 AeadAes128Gcm = 0x0007,
8}
9
10impl ProtectionProfile {
11 pub fn key_len(&self) -> usize {
12 match *self {
13 ProtectionProfile::Aes128CmHmacSha1_80 | ProtectionProfile::AeadAes128Gcm => 16,
14 }
15 }
16
17 pub fn salt_len(&self) -> usize {
18 match *self {
19 ProtectionProfile::Aes128CmHmacSha1_80 => 14,
20 ProtectionProfile::AeadAes128Gcm => 12,
21 }
22 }
23
24 pub fn auth_tag_len(&self) -> usize {
25 match *self {
26 ProtectionProfile::Aes128CmHmacSha1_80 => 10, ProtectionProfile::AeadAes128Gcm => 16, }
29 }
30
31 pub fn auth_key_len(&self) -> usize {
32 match *self {
33 ProtectionProfile::Aes128CmHmacSha1_80 => 20,
34 ProtectionProfile::AeadAes128Gcm => 0,
35 }
36 }
37}