1; Copyright (c) 2021 Fraunhofer AISEC. See the COPYRIGHT
2; file at the top-level directory of this distribution.
3
4; Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
5; http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6; <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
7; option. This file may not be copied, modified, or distributed
8; except according to those terms.
9
10; This file should be processed with cddl-gen (https://github.com/NordicSemiconductor/cddl-gen/tree/master) to create cbor encoding and decoding code
11
12; plaintext 2
13ptxt2 = ( C_R: int / bstr, ID_CRED_R: map2 / bstr / int, SGN_or_MAC_2: bstr, ? EAD_2: bstr)
14
15; plaintext 3
16ptxt3 = ( ID_CRED_I: map3 / bstr / int, SGN_or_MAC_3: bstr, ? EAD_3: bstr)
17
18;currently x5bag and x5u are not supported
19map2 = {
20	? kid: 4 =>  int / bstr,
21
22	? x5bag: 32 => bstr,
23	? x5chain: 33 => bstr,
24	? x5t: 34 => [alg: (int / tstr), hash: bstr ],
25	? x5u: 35 => bstr,
26
27	? c5b: 52 => bstr,
28	? c5c: 53 => bstr,
29	? c5t: 54 => [alg: (int / tstr), hash: bstr ],
30	? c5u: 55 => bstr,
31}
32
33map3 = {
34	? kid: 4 =>  int / bstr,
35
36	? x5bag: 32 => bstr,
37	? x5chain: 33 => bstr,
38	? x5t: 34 => [alg: (int / tstr), hash: bstr ],
39	? x5u: 35 => bstr,
40
41	? c5b: 52 => bstr,
42	? c5c: 53 => bstr,
43	? c5t: 54 => [alg: (int / tstr), hash: bstr ],
44	? c5u: 55 => bstr,
45}
46
47;map and id_cred_x_map are identical.
48;We just need different names to resolve inclusion conflicts
49id_cred_x_map = {
50	? kid: 4 =>  int / bstr,
51;-------------------------------------------------------------------------------
52	? x5bag: 32 => bstr, ; unordered set of x509 certificates
53	? x5chain: 33 => bstr, ; chain of x509 certificates
54	? x5t: 34 => [alg: (int / tstr), hash: bstr ], ; x509 certificate identified by hash value
55	? x5u: 35 => bstr, ; x509 certificate identified by URI
56;-------------------------------------------------------------------------------
57	? c5b: 52 => bstr, ; unordered set of x509 certificates
58	? c5c: 53 => bstr, ; chain of c509 certificate
59	? c5t: 54 => [alg: (int / tstr), hash: bstr ], ; c509 certificate identified by hash value
60	? c5u: 55 => bstr, ; c509 certificate identified by URI
61;-------------------------------------------------------------------------------
62;	? kcwt: 42 => xxx, ; COSE Web Token (CWT)
63;	? kccs: 43 => xxx, ; CWT Claim Set (CCS)
64}
65
66; COSE_CertHash = [ hashAlg: (int / tstr), hashValue: bstr ]
67
68; COSE_X509 = bstr / [ 2*certs: bstr ]
69; COSE_C509 = C509Certificate / [ 2* C509Certificate ]
70
71;     C509Certificate = [
72;        TBSCertificate,
73;        issuerSignatureValue : any,
74;     ]
75
76;     ; The elements of the following group are used in a CBOR Sequence:
77;     TBSCertificate = (
78;        c509CertificateType: int,
79;        certificateSerialNumber: CertificateSerialNumber,
80;        issuer: Name,
81;        validityNotBefore: Time,
82;        validityNotAfter: Time,
83;        subject: Name,
84;        subjectPublicKeyAlgorithm: AlgorithmIdentifier,
85;        subjectPublicKey: any,
86;        extensions: Extensions,
87;        issuerSignatureAlgorithm: AlgorithmIdentifier,
88;     )
89
90; CBOR Object Signing and Encryption (COSE): Header parameters for carrying and referencing X.509 certificates https://datatracker.ietf.org/doc/draft-ietf-cose-x509/
91
92; CBOR Encoded X.509 Certificates (C509 Certificates) https://datatracker.ietf.org/doc/draft-ietf-cose-cbor-encoded-cert/
93
94