Bug 1885489 - Part 9: Add SnapshotIterator::readObject(). r=iain
[gecko.git] / security / ct / BTTypes.h
blobaa160721509cc5f309c57ddfe123a82909803f2f
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef BTTypes_h
8 #define BTTypes_h
10 #include <vector>
12 #include "Buffer.h"
14 namespace mozilla {
15 namespace ct {
17 // Represents a Merkle inclusion proof for purposes of serialization,
18 // deserialization, and verification of the proof. The format for inclusion
19 // proofs in RFC 6962-bis is as follows:
21 // opaque LogID<2..127>;
22 // opaque NodeHash<32..2^8-1>;
24 // struct {
25 // LogID log_id;
26 // uint64 tree_size;
27 // uint64 leaf_index;
28 // NodeHash inclusion_path<1..2^16-1>;
29 // } InclusionProofDataV2;
31 struct InclusionProofDataV2 {
32 Buffer logId;
33 uint64_t treeSize;
34 uint64_t leafIndex;
35 std::vector<Buffer> inclusionPath;
38 // Represents a Signed Tree Head as per RFC 6962-bis. All extensions are
39 // ignored. The signature field covers the data in the tree_head field.
41 // struct {
42 // LogID log_id;
43 // TreeHeadDataV2 tree_head;
44 // opaque signature<0..2^16-1>;
45 // } SignedTreeHeadDataV2;
47 // struct {
48 // uint64 timestamp;
49 // uint64 tree_size;
50 // NodeHash root_hash;
51 // Extension sth_extensions<0..2^16-1>;
52 // } TreeHeadDataV2;
54 struct SignedTreeHeadDataV2 {
55 Buffer logId;
56 uint64_t timestamp;
57 uint64_t treeSize;
58 Buffer rootHash;
61 } // namespace ct
62 } // namespace mozilla
64 #endif // BTTypes_h