| 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 12 matching lines...) Expand all Loading... |
| 23 // slightly differently. | 23 // slightly differently. |
| 24 struct NET_EXPORT MerkleTreeLeaf { | 24 struct NET_EXPORT MerkleTreeLeaf { |
| 25 // Version enum in RFC 6962, Section 3.2. | 25 // Version enum in RFC 6962, Section 3.2. |
| 26 enum Version { VERSION_1 = 0, }; | 26 enum Version { VERSION_1 = 0, }; |
| 27 // MerkleLeafType enum in RFC 6962, Section 3.4. | 27 // MerkleLeafType enum in RFC 6962, Section 3.4. |
| 28 enum Type { TYPE_TIMESTAMPED_ENTRY = 0, }; | 28 enum Type { TYPE_TIMESTAMPED_ENTRY = 0, }; |
| 29 | 29 |
| 30 MerkleTreeLeaf(); | 30 MerkleTreeLeaf(); |
| 31 ~MerkleTreeLeaf(); | 31 ~MerkleTreeLeaf(); |
| 32 | 32 |
| 33 // Sets |*out| to the hash of this Merkle tree leaf, as defined in RFC6962. |
| 34 // Returns true if the hash was generated, false if an error occurred. |
| 35 bool Hash(std::string* out) const; |
| 36 |
| 33 // Version and Merkle leaf type fields are omitted, as there is only one | 37 // Version and Merkle leaf type fields are omitted, as there is only one |
| 34 // possible value for each of them in CTv1. | 38 // possible value for each of them in CTv1. |
| 35 | 39 |
| 36 // The log id this leaf belongs to. | 40 // The log id this leaf belongs to. |
| 37 std::string log_id; | 41 std::string log_id; |
| 38 | 42 |
| 39 // Certificate / Precertificate and indication of entry type. | 43 // Certificate / Precertificate and indication of entry type. |
| 40 LogEntry log_entry; | 44 LogEntry log_entry; |
| 41 | 45 |
| 42 // Timestamp from the SCT. | 46 // Timestamp from the SCT. |
| 43 base::Time timestamp; | 47 base::Time timestamp; |
| 44 | 48 |
| 45 // Extensions from the SCT. | 49 // Extensions from the SCT. |
| 46 std::string extensions; | 50 std::string extensions; |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert, | 53 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert, |
| 50 const SignedCertificateTimestamp* sct, | 54 const SignedCertificateTimestamp* sct, |
| 51 MerkleTreeLeaf* merkle_tree_leaf); | 55 MerkleTreeLeaf* merkle_tree_leaf); |
| 52 | 56 |
| 53 } // namespace ct | 57 } // namespace ct |
| 54 | 58 |
| 55 } // namespace net | 59 } // namespace net |
| 56 | 60 |
| 57 #endif // NET_CERT_MERKLE_TREE_LEAF_H_ | 61 #endif // NET_CERT_MERKLE_TREE_LEAF_H_ |
| OLD | NEW |