1use crate::ToPrefixedLabel;
2
3#[derive(
7 Debug, Clone, Copy, PartialEq, Eq, Hash, strum::IntoStaticStr, strum::EnumString, strum::Display,
8)]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10#[repr(u8)]
11pub enum SignatureLabel {
12 FramedContentTBS,
13 LeafNodeTBS,
14 KeyPackageTBS,
15 GroupInfoTBS,
16 #[cfg(feature = "draft-ietf-mls-extensions")]
17 TargetedMessagesTBS,
18 #[cfg(feature = "draft-ietf-mls-extensions")]
19 CredentialBindingTBS,
20 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
21 AssociatedPartyEntryTBS,
22 #[cfg(feature = "test-vectors")]
23 #[strum(serialize = "SignWithLabel")]
24 TestVectorSignWithLabel,
25}
26
27impl ToPrefixedLabel for SignatureLabel {}
28
29#[derive(
33 Debug,
34 Clone,
35 PartialEq,
36 Eq,
37 Hash,
38 strum::IntoStaticStr,
39 strum::EnumString,
40 strum::Display,
41 strum::AsRefStr,
42)]
43#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
44#[repr(u8)]
45pub enum PublicKeyEncryptionLabel {
46 UpdatePathNode,
47 Welcome,
48 #[cfg(feature = "draft-mahy-mls-semiprivatemessage")]
49 SemiPrivateMessageReceiver,
50 #[cfg(feature = "test-vectors")]
51 #[strum(serialize = "EncryptWithLabel")]
52 TestVectorEncryptWithLabel,
53}
54
55impl ToPrefixedLabel for PublicKeyEncryptionLabel {}
56
57#[derive(
61 Debug, Clone, Copy, PartialEq, Eq, Hash, strum::IntoStaticStr, strum::EnumString, strum::Display,
62)]
63#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
64#[repr(u8)]
65pub enum HashReferenceKind {
66 #[strum(serialize = "KeyPackage Reference")]
67 KeyPackageRef,
68 #[strum(serialize = "Proposal Reference")]
69 ProposalRef,
70 #[cfg(feature = "test-vectors")]
71 #[strum(serialize = "RefHash")]
72 TestVectorRefHash,
73}
74
75impl ToPrefixedLabel for HashReferenceKind {}
76
77#[derive(
81 Debug,
82 Clone,
83 PartialEq,
84 Eq,
85 Hash,
86 strum::IntoStaticStr,
87 strum::EnumString,
88 strum::Display,
89 strum::AsRefStr,
90)]
91#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
92#[repr(u8)]
93#[strum(serialize_all = "lowercase")]
94pub enum KdfLabelKind {
95 Joiner,
96 Welcome,
97 Epoch,
98 Init,
99 #[strum(serialize = "sender data")]
100 SenderData,
101 Encryption,
102 Exported,
103 Exporter,
104 External,
105 Confirm,
106 Membership,
107 Resumption,
108 Authentication,
109 Application,
110 Handshake,
111 Tree,
112 Nonce,
113 Key,
114 Secret,
115 Path,
116 Node,
117 #[strum(serialize = "derived psk")]
118 DerivedPsk,
119 #[cfg(feature = "draft-ietf-mls-extensions")]
120 #[strum(serialize = "targeted message psk")]
121 TargetedMessagePsk,
122 #[cfg(feature = "draft-ietf-mls-extensions")]
123 #[strum(serialize = "targeted message sender auth data")]
124 TargetedMessageSenderAuthData,
125 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
126 #[strum(serialize = "ap_epoch")]
127 AssociatedPartyKeyScheduleEpochSecret,
128 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
129 #[strum(serialize = "ap_exporter")]
130 AssociatedPartyKeyScheduleExporterSecret,
131 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
132 #[strum(serialize = "AP Secret")]
133 AssociatedPartyEpochSecret,
134 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
135 #[strum(serialize = "AP Exporter Secret")]
136 AssociatedPartySecret,
137 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
138 #[strum(serialize = "AP Commit Secret")]
139 AssociatedPartyCommitSecret,
140 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
141 #[strum(serialize = "AP Commit Secret ID")]
142 AssociatedPartyCommitSecretId,
143 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
144 #[strum(serialize = "AP Commit Base Secret")]
145 AssociatedPartyCommitBaseSecret,
146 #[cfg(feature = "draft-ietf-mls-combiner")]
147 #[strum(serialize = "hpqmls_export")]
148 HpqMlsExport,
149 #[cfg(feature = "draft-ietf-mls-extensions")]
150 #[strum(serialize = "application_export")]
151 ApplicationExportSecret,
152 #[cfg(feature = "test-vectors")]
153 #[strum(serialize = "DeriveTreeSecret")]
154 TestVectorDeriveTreeSecret,
155 #[cfg(feature = "test-vectors")]
156 #[strum(serialize = "DeriveSecret")]
157 TestVectorDeriveSecret,
158 #[cfg(feature = "test-vectors")]
159 #[strum(serialize = "ExpandWithLabel")]
160 TestVectorExpandWithLabel,
161 #[strum(serialize = "{0}")]
162 Arbitrary(String),
163}
164
165impl ToPrefixedLabel for KdfLabelKind {
166 fn to_prefixed_string(&self, protocol_version: crate::defs::ProtocolVersion) -> String {
167 format!("{protocol_version} {self}")
168 }
169}