1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use serde::Deserialize;
use serde::Serialize;
#[allow(non_camel_case_types)]
#[non_exhaustive]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum CekAlgorithm {
ECDH_ES(AgreementInfo),
ECDH_ES_A256KW(AgreementInfo),
}
impl CekAlgorithm {
pub const fn name(&self) -> &'static str {
match self {
CekAlgorithm::ECDH_ES(_) => "ECDH-ES",
CekAlgorithm::ECDH_ES_A256KW(_) => "ECDH-ES+A256KW",
}
}
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct AgreementInfo {
pub apu: Vec<u8>,
pub apv: Vec<u8>,
pub pub_info: Vec<u8>,
pub priv_info: Vec<u8>,
}
impl AgreementInfo {
pub fn new(apu: Vec<u8>, apv: Vec<u8>, pub_info: Vec<u8>, priv_info: Vec<u8>) -> Self {
Self {
apu,
apv,
pub_info,
priv_info,
}
}
}