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
12plaintext = ( ? C_R: int / bstr, ID_CRED_x: map / bstr / int, SGN_or_MAC_x: bstr, ? AD_x: bstr)
13
14;currently x5bag and x5u are not supported
15map = {
16	? kid: 4 =>  int / bstr,
17
18	? x5bag: 32 => bstr,
19	? x5chain: 33 => bstr,
20	? x5t: 34 => [alg: (int / tstr), hash: bstr ],
21	? x5u: 35 => bstr,
22
23	? c5b: 52 => bstr,
24	? c5c: 53 => bstr,
25	? c5t: 54 => [alg: (int / tstr), hash: bstr ],
26	? c5u: 55 => bstr,
27}
28
29;map and id_cred_x_map are identical.
30;We just need different names to resolve inclusion conflicts
31id_cred_x_map = {
32	? kid: 4 =>  int / bstr,
33;-------------------------------------------------------------------------------
34	? x5bag: 32 => bstr, ; unordered set of x509 certificates
35	? x5chain: 33 => bstr, ; chain of x509 certificates
36	? x5t: 34 => [alg: (int / tstr), hash: bstr ], ; x509 certificate identified by hash value
37	? x5u: 35 => bstr, ; x509 certificate identified by URI
38;-------------------------------------------------------------------------------
39	? c5b: 52 => bstr, ; unordered set of x509 certificates
40	? c5c: 53 => bstr, ; chain of c509 certificate
41	? c5t: 54 => [alg: (int / tstr), hash: bstr ], ; c509 certificate identified by hash value
42	? c5u: 55 => bstr, ; c509 certificate identified by URI
43;-------------------------------------------------------------------------------
44;	? kcwt: 42 => xxx, ; COSE Web Token (CWT)
45;	? kccs: 43 => xxx, ; CWT Claim Set (CCS)
46}
47
48; COSE_CertHash = [ hashAlg: (int / tstr), hashValue: bstr ]
49
50; COSE_X509 = bstr / [ 2*certs: bstr ]
51; COSE_C509 = C509Certificate / [ 2* C509Certificate ]
52
53;     C509Certificate = [
54;        TBSCertificate,
55;        issuerSignatureValue : any,
56;     ]
57
58;     ; The elements of the following group are used in a CBOR Sequence:
59;     TBSCertificate = (
60;        c509CertificateType: int,
61;        certificateSerialNumber: CertificateSerialNumber,
62;        issuer: Name,
63;        validityNotBefore: Time,
64;        validityNotAfter: Time,
65;        subject: Name,
66;        subjectPublicKeyAlgorithm: AlgorithmIdentifier,
67;        subjectPublicKey: any,
68;        extensions: Extensions,
69;        issuerSignatureAlgorithm: AlgorithmIdentifier,
70;     )
71
72; CBOR Object Signing and Encryption (COSE): Header parameters for carrying and referencing X.509 certificates https://datatracker.ietf.org/doc/draft-ietf-cose-x509/
73
74; CBOR Encoded X.509 Certificates (C509 Certificates) https://datatracker.ietf.org/doc/draft-ietf-cose-cbor-encoded-cert/
75
76