|
10 | 10 |
|
11 | 11 | namespace ccf::crypto |
12 | 12 | { |
13 | | - // Standardised field: COSE tag. |
14 | | - static constexpr int64_t COSE_TAG = 18; |
15 | | - // Standardised field: algorithm used to sign. |
16 | | - static constexpr int64_t COSE_PHEADER_KEY_ALG = 1; |
17 | | - // Standardised: hash of the signing key. |
18 | | - static constexpr int64_t COSE_PHEADER_KEY_ID = 4; |
19 | | - // Standardised: CWT claims map. |
20 | | - static constexpr int64_t COSE_PHEADER_KEY_CWT = 15; |
21 | | - // Standardised: verifiable data structure. |
22 | | - // https://www.ietf.org/archive/id/draft-ietf-cose-merkle-tree-proofs-18.html#name-cose-header-parameter |
23 | | - static constexpr int64_t COSE_PHEADER_KEY_VDS = 395; |
24 | | - static constexpr int64_t COSE_PHEADER_VDS_CCF_LEDGER_SHA256 = 2; |
25 | | - // Standardised: issued at CWT claim. Value is **PLAIN INTEGER**, as per |
26 | | - // https://www.rfc-editor.org/rfc/rfc8392#section-2. Quote: |
27 | | - /* The "NumericDate" term in this specification has the same meaning and |
28 | | - * processing rules as the JWT "NumericDate" term defined in Section 2 of |
29 | | - * [RFC7519], except that it is represented as a CBOR numericdate (from |
30 | | - * Section 2.4.1 of [RFC7049]) instead of a JSON number. The encoding is |
31 | | - * modified so that the leading tag 1 (epoch-based date/time) MUST be |
32 | | - * omitted. |
33 | | - */ |
34 | | - static constexpr int64_t COSE_PHEADER_KEY_IAT = 6; |
35 | | - // Standardised: issuer CWT claim. |
36 | | - // https://www.iana.org/assignments/cose/cose.xhtml#header-parameters |
37 | | - /* The "iss" (issuer) claim identifies the principal that issued the CWT. |
38 | | - * The "iss" value is a case-sensitive string containing a StringOrURI value. |
39 | | - */ |
40 | | - static constexpr int64_t COSE_PHEADER_KEY_ISS = 1; |
41 | | - // Standardised: subject CWT claim. |
42 | | - // https://www.iana.org/assignments/cose/cose.xhtml#header-parameters |
43 | | - /* The "sub" (subject) claim identifies the principal that is the subject of |
44 | | - * the CWT. The claims in a CWT are normally statements about the subject. |
45 | | - * The "sub" value is a case-sensitive string containing a StringOrURI value. |
46 | | - */ |
47 | | - static constexpr int64_t COSE_PHEADER_KEY_SUB = 2; |
48 | | - // CCF headers nested map key. |
49 | | - static const std::string COSE_PHEADER_KEY_CCF = "ccf.v1"; |
50 | | - // CCF-specific: last signed TxID. |
51 | | - static const std::string COSE_PHEADER_KEY_TXID = "txid"; |
52 | | - // CCF-specific: first TX in the range. |
53 | | - static const std::string COSE_PHEADER_KEY_RANGE_BEGIN = "epoch.start.txid"; |
54 | | - // CCF-specific: last TX included in the range. |
55 | | - static const std::string COSE_PHEADER_KEY_RANGE_END = "epoch.end.txid"; |
56 | | - // CCF-specific: last signed Merkle root hash in the range. |
57 | | - static const std::string COSE_PHEADER_KEY_EPOCH_LAST_MERKLE_ROOT = |
58 | | - "epoch.end.merkle.root"; |
59 | | - static const std::string COSE_PHEADER_UVM_SVN = "svn"; |
60 | | - |
61 | 13 | struct COSESignError : public std::runtime_error |
62 | 14 | { |
63 | 15 | COSESignError(const std::string& msg) : std::runtime_error(msg) {} |
|
0 commit comments