OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_CERT_MERKLE_TREE_LEAF_H_ | 5 #ifndef NET_CERT_MERKLE_TREE_LEAF_H_ |
6 #define NET_CERT_MERKLE_TREE_LEAF_H_ | 6 #define NET_CERT_MERKLE_TREE_LEAF_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 // for the entry. | 24 // for the entry. |
25 // | 25 // |
26 // As such, it has all the data as the MerkleTreeLeaf defined in the RFC, | 26 // As such, it has all the data as the MerkleTreeLeaf defined in the RFC, |
27 // but it is not identical to the structure in the RFC for the following | 27 // but it is not identical to the structure in the RFC for the following |
28 // reasons: | 28 // reasons: |
29 // * The version is implicit - it is only used for V1 leaves currently. | 29 // * The version is implicit - it is only used for V1 leaves currently. |
30 // * the leaf_type is also implicit: There's exactly one leaf type and no | 30 // * the leaf_type is also implicit: There's exactly one leaf type and no |
31 // new types are planned. | 31 // new types are planned. |
32 // * The timestamped_entry's |timestamp| and |extensions| fields are directly | 32 // * The timestamped_entry's |timestamp| and |extensions| fields are directly |
33 // accessible. | 33 // accessible. |
34 // * The timestamped_entry's entry_type can be deduced from |log_entry|.type | 34 // * The timestamped_entry's entry_type can be deduced from |signed_entry|.type |
35 struct NET_EXPORT MerkleTreeLeaf { | 35 struct NET_EXPORT MerkleTreeLeaf { |
36 MerkleTreeLeaf(); | 36 MerkleTreeLeaf(); |
37 MerkleTreeLeaf(const MerkleTreeLeaf& other); | 37 MerkleTreeLeaf(const MerkleTreeLeaf& other); |
38 MerkleTreeLeaf(MerkleTreeLeaf&&); | 38 MerkleTreeLeaf(MerkleTreeLeaf&&); |
39 ~MerkleTreeLeaf(); | 39 ~MerkleTreeLeaf(); |
40 | 40 |
41 // Certificate / Precertificate and indication of entry type. | 41 // Certificate / Precertificate and indication of entry type. |
42 LogEntry log_entry; | 42 SignedEntryData signed_entry; |
43 | 43 |
44 // Timestamp from the SCT. | 44 // Timestamp from the SCT. |
45 base::Time timestamp; | 45 base::Time timestamp; |
46 | 46 |
47 // Extensions from the SCT. | 47 // Extensions from the SCT. |
48 std::string extensions; | 48 std::string extensions; |
49 }; | 49 }; |
50 | 50 |
51 // Given a |cert| and an |sct| for that certificate, constructs the | 51 // Given a |cert| and an |sct| for that certificate, constructs the |
52 // representation of this entry in the Merkle tree by filling in | 52 // representation of this entry in the Merkle tree by filling in |
53 // |merkle_tree_leaf|. | 53 // |merkle_tree_leaf|. |
54 // Returns false if it failed to construct the |merkle_tree_leaf|. | 54 // Returns false if it failed to construct the |merkle_tree_leaf|. |
55 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert, | 55 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert, |
56 const SignedCertificateTimestamp* sct, | 56 const SignedCertificateTimestamp* sct, |
57 MerkleTreeLeaf* merkle_tree_leaf); | 57 MerkleTreeLeaf* merkle_tree_leaf); |
58 | 58 |
59 // Sets |*out| to the hash of the Merkle |tree_leaf|, as defined in RFC6962, | 59 // Sets |*out| to the hash of the Merkle |tree_leaf|, as defined in RFC6962, |
60 // section 3.4. Returns true if the hash was generated, false if an error | 60 // section 3.4. Returns true if the hash was generated, false if an error |
61 // occurred. | 61 // occurred. |
62 NET_EXPORT bool HashMerkleTreeLeaf(const MerkleTreeLeaf& tree_leaf, | 62 NET_EXPORT bool HashMerkleTreeLeaf(const MerkleTreeLeaf& tree_leaf, |
63 std::string* out); | 63 std::string* out); |
64 | 64 |
65 } // namespace ct | 65 } // namespace ct |
66 | 66 |
67 } // namespace net | 67 } // namespace net |
68 | 68 |
69 #endif // NET_CERT_MERKLE_TREE_LEAF_H_ | 69 #endif // NET_CERT_MERKLE_TREE_LEAF_H_ |
OLD | NEW |