-
Notifications
You must be signed in to change notification settings - Fork 10
/
examples.cddl
107 lines (93 loc) · 3.69 KB
/
examples.cddl
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Example = {
title: tstr, # summary of test
? description: tstr, # longer description of test
? fail : bool, # Is this a success or failure test
input: Inputs, # Inputs to create the test
? intermediates : Intermediates, # Intermediate values for debugging
output: Outputs # Outputs of the test
}
Inputs = {
plaintext: bstr / tstr,
? detached: bool,
(enveloped: Enveloped) / # Create an enveloped Message
(encrypt: Encrypt) / # Create an encrypt Message
(mac: Mac) / # Create a MAC message
(mac0: Mac0) / # Craete a MAC0 message
(sign: Sign),
? failures : FailureSet, # Description of failure changes applied
? rng_description : tstr, # What is what in the RNG stream
? rng_stream: [+ tstr] # Random number generator stream - encoded as hex
}
Sign = {
signers: [+ Signers]
}
headers = (
? protected: { +header_items }, # Protected headers to be sent
? unprotected: { +header_items }, # Unprotected headers to be sent
? unsent: { +header_items } # Headers not to be sent
}
header_items = (
"alg" : tstr, # Algorithm parameter
"kid" : tstr, # key identifier - cast to bstr
"kid_hex" : tstr, # key identifier - encoded as hex
"epk" : key, # ephemeral key
"spk" : key, # static key
"spk_kid" : tstr, # static key identifier - cast to bstr
"spk_kid_hex" : tstr, # static key identifier - encoded as hex
"apu_id" : tstr, # PartyU identifier - cast to bstr
"apu_nonce_hex" : tstr, # PartyU nonce - encoded as hex
"apv_id" : tstr, # PartyV identifier - cast to bstr
"pub_other" : tstr, # Public other Info - cast to bstr
"salt" : tstr, # Salt value - cast to bstr
)
Signers = {
alg: tstr,
key: Key,
headers
}
Mac = {
alg: tstr,
headers,
recipients: [+ Recipients]
}
Mac0 = {
alg: tstr,
headers
}
Encrypt = {
alg: tstr,
headers
}
Enveloped = {
alg: tstr,
headers,
recipients: [+ Recipients]
}
Recipient = {
alg: tstr,
? fail: bool, # does this recipient fail
headers, # Headers for the recipient
key: Key, # Recipient Key
? sender_key: Key, # Sender key
failures: Failures # Set of failures to apply to recipient
}
Key = {
(tstr/int) => *
}
Failures = {
}
Outputs = {
? cbor: bstr, # CBOR encoding in HEX
? cbor_diag: tstr, # CBOR Diagnositc encoding
? content : bstr # deatched content encoded in HEX
}
Intermediates = {
? "ToMax_hex": tstr, # Value to be MAC-ed encoded in HEX
? "CEK_hex": tstr, # CEK used in MAC or encryption encoded in hex
? "AAD_hex": tstr, # AEAD Additional Data encoded in hex
? "recipients" : [ +{
? "Context_hex": tstr, # Context structure encoded in hex
? "Secret_hex" : tstr, # ECDH shared secret encoded in hex
}]
]
}