ipmi_rs/connection/impls/rmcp/v2_0/crypto/
confidentiality.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
2pub enum ConfidentialityAlgorithm {
3 None,
4 AesCbc128,
5 Xrc4_128,
6 Xrc4_40,
7}
8
9impl TryFrom<u8> for ConfidentialityAlgorithm {
10 type Error = ();
11
12 fn try_from(value: u8) -> Result<Self, Self::Error> {
13 let value = match value {
14 0x00 => Self::None,
15 0x01 => Self::AesCbc128,
16 0x02 => Self::Xrc4_128,
17 0x03 => Self::Xrc4_40,
18 _ => return Err(()),
19 };
20
21 Ok(value)
22 }
23}
24
25impl From<ConfidentialityAlgorithm> for u8 {
26 fn from(value: ConfidentialityAlgorithm) -> Self {
27 match value {
28 ConfidentialityAlgorithm::None => 0x00,
29 ConfidentialityAlgorithm::AesCbc128 => 0x01,
30 ConfidentialityAlgorithm::Xrc4_128 => 0x02,
31 ConfidentialityAlgorithm::Xrc4_40 => 0x03,
32 }
33 }
34}