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-targeted-messages")]
17 TargetedMessagesTBS,
18 #[cfg(feature = "draft-ietf-mls-extensions")]
19 CredentialBindingTBS,
20 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
21 AssociatedPartyEntryTBS,
22 #[cfg(feature = "draft-mahy-mls-private-external")]
23 ExternalEncryptionInfoTBS,
24 #[cfg(feature = "draft-kohbrok-mls-leaf-operation-intents")]
25 LeafOperationIntentTBS,
26 #[cfg(feature = "test-vectors")]
27 #[strum(serialize = "SignWithLabel")]
28 TestVectorSignWithLabel,
29}
30
31impl ToPrefixedLabel for SignatureLabel {}
32
33#[derive(
37 Debug,
38 Clone,
39 PartialEq,
40 Eq,
41 Hash,
42 strum::IntoStaticStr,
43 strum::EnumString,
44 strum::Display,
45 strum::AsRefStr,
46)]
47#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
48#[repr(u8)]
49pub enum PublicKeyEncryptionLabel {
50 UpdatePathNode,
51 Welcome,
52 #[cfg(feature = "draft-mahy-mls-semiprivatemessage")]
53 SemiPrivateMessageReceiver,
54 #[cfg(feature = "draft-mahy-mls-private-external")]
55 PrivateExternalMessageContent,
56 #[cfg(feature = "draft-ietf-mls-targeted-messages")]
57 TargetedMessageData,
58 #[cfg(feature = "test-vectors")]
59 #[strum(serialize = "EncryptWithLabel")]
60 TestVectorEncryptWithLabel,
61}
62
63impl ToPrefixedLabel for PublicKeyEncryptionLabel {}
64
65#[derive(
69 Debug, Clone, Copy, PartialEq, Eq, Hash, strum::IntoStaticStr, strum::EnumString, strum::Display,
70)]
71#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
72#[repr(u8)]
73pub enum HashReferenceKind {
74 #[strum(serialize = "KeyPackage Reference")]
75 KeyPackageRef,
76 #[strum(serialize = "Proposal Reference")]
77 ProposalRef,
78 #[cfg(feature = "draft-kohbrok-mls-leaf-operation-intents")]
79 #[strum(serialize = "LeafNode Reference")]
80 LeafNodeRef,
81 #[cfg(feature = "test-vectors")]
82 #[strum(serialize = "RefHash")]
83 TestVectorRefHash,
84}
85
86impl ToPrefixedLabel for HashReferenceKind {}
87
88#[derive(
92 Debug,
93 Clone,
94 PartialEq,
95 Eq,
96 Hash,
97 strum::IntoStaticStr,
98 strum::EnumString,
99 strum::Display,
100 strum::AsRefStr,
101)]
102#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
103#[repr(u8)]
104#[strum(serialize_all = "lowercase")]
105pub enum KdfLabelKind {
106 Joiner,
107 Welcome,
108 Epoch,
109 Init,
110 #[strum(serialize = "sender data")]
111 SenderData,
112 Encryption,
113 Exported,
114 Exporter,
115 External,
116 Confirm,
117 Membership,
118 Resumption,
119 Authentication,
120 Application,
121 Handshake,
122 #[cfg(feature = "draft-mahy-mls-new-content-types")]
123 Status,
124 #[cfg(feature = "draft-mahy-mls-new-content-types")]
125 Ephemeral,
126 Tree,
127 Nonce,
128 Key,
129 Secret,
130 Path,
131 Node,
132 #[strum(serialize = "derived psk")]
133 DerivedPsk,
134 #[cfg(feature = "draft-ietf-mls-targeted-messages")]
135 #[strum(serialize = "targeted message psk")]
136 TargetedMessagePsk,
137 #[cfg(feature = "draft-ietf-mls-targeted-messages")]
138 #[strum(serialize = "targeted message sender auth data")]
139 TargetedMessageSenderAuthData,
140 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
141 #[strum(serialize = "ap_epoch")]
142 AssociatedPartyKeyScheduleEpochSecret,
143 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
144 #[strum(serialize = "ap_exporter")]
145 AssociatedPartyKeyScheduleExporterSecret,
146 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
147 #[strum(serialize = "AP Secret")]
148 AssociatedPartyEpochSecret,
149 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
150 #[strum(serialize = "AP Exporter Secret")]
151 AssociatedPartySecret,
152 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
153 #[strum(serialize = "AP Commit Secret")]
154 AssociatedPartyCommitSecret,
155 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
156 #[strum(serialize = "AP Commit Secret ID")]
157 AssociatedPartyCommitSecretId,
158 #[cfg(feature = "draft-kohbrok-mls-associated-parties")]
159 #[strum(serialize = "AP Commit Base Secret")]
160 AssociatedPartyCommitBaseSecret,
161 #[cfg(feature = "draft-ietf-mls-extensions")]
162 #[strum(serialize = "application_export")]
163 ApplicationExportSecret,
164 #[cfg(feature = "draft-mahy-mls-private-external")]
165 #[strum(serialize = "external encryption")]
166 ExternalEncryption,
167 #[cfg(feature = "test-vectors")]
168 #[strum(serialize = "DeriveTreeSecret")]
169 TestVectorDeriveTreeSecret,
170 #[cfg(feature = "test-vectors")]
171 #[strum(serialize = "DeriveSecret")]
172 TestVectorDeriveSecret,
173 #[cfg(feature = "test-vectors")]
174 #[strum(serialize = "ExpandWithLabel")]
175 TestVectorExpandWithLabel,
176 #[strum(serialize = "{0}")]
177 Arbitrary(String),
178}
179
180impl ToPrefixedLabel for KdfLabelKind {
181 fn to_prefixed_string(&self, protocol_version: crate::defs::ProtocolVersion) -> String {
182 format!("{protocol_version} {self}")
183 }
184}