Chromium Code Reviews| 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 |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 13 #include "net/cert/signed_certificate_timestamp.h" | 13 #include "net/cert/signed_certificate_timestamp.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class X509Certificate; | 17 class X509Certificate; |
| 18 | 18 |
| 19 namespace ct { | 19 namespace ct { |
| 20 | 20 |
| 21 // Represents a MerkleTreeLeaf as defined in RFC6962, section 3.4. | 21 // Represents a MerkleTreeLeaf as defined in RFC6962, section 3.4. |
|
Ryan Sleevi
2016/06/30 22:48:19
Unfortunately, finding an explanation about how th
Eran Messeri
2016/07/01 13:24:01
Expanded the documentation (in another CL) to indi
| |
| 22 // Has all the data as the MerkleTreeLeaf defined in the RFC, arranged | 22 // Has all the data as the MerkleTreeLeaf defined in the RFC, arranged |
| 23 // slightly differently. | 23 // slightly differently. |
|
Ryan Sleevi
2016/06/30 22:48:19
Does RFC 6962-bis do something differently? It's u
Ryan Sleevi
2016/06/30 22:48:19
Why is it arranged differently?
Eran Messeri
2016/07/01 13:24:01
Yes, 6962-bis does (see details in the other comme
Eran Messeri
2016/07/01 13:24:01
Explained (in another CL).
| |
| 24 struct NET_EXPORT MerkleTreeLeaf { | 24 struct NET_EXPORT MerkleTreeLeaf { |
| 25 MerkleTreeLeaf(); | 25 MerkleTreeLeaf(); |
| 26 MerkleTreeLeaf(const MerkleTreeLeaf& other); | |
| 27 MerkleTreeLeaf(MerkleTreeLeaf&&); | |
| 26 ~MerkleTreeLeaf(); | 28 ~MerkleTreeLeaf(); |
| 27 | 29 |
| 28 // The log id this leaf belongs to. | 30 // The log id this leaf belongs to. |
| 29 std::string log_id; | 31 std::string log_id; |
| 30 | 32 |
| 31 // Certificate / Precertificate and indication of entry type. | 33 // Certificate / Precertificate and indication of entry type. |
| 32 LogEntry log_entry; | 34 LogEntry log_entry; |
| 33 | 35 |
| 34 // Timestamp from the SCT. | 36 // Timestamp from the SCT. |
| 35 base::Time timestamp; | 37 base::Time timestamp; |
| 36 | 38 |
| 37 // Extensions from the SCT. | 39 // Extensions from the SCT. |
| 38 std::string extensions; | 40 std::string extensions; |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert, | 43 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert, |
|
Ryan Sleevi
2016/06/30 22:48:19
Should have been documented.
Eran Messeri
2016/07/01 13:24:01
Done (in a separate CL).
| |
| 42 const SignedCertificateTimestamp* sct, | 44 const SignedCertificateTimestamp* sct, |
| 43 MerkleTreeLeaf* merkle_tree_leaf); | 45 MerkleTreeLeaf* merkle_tree_leaf); |
| 44 | 46 |
| 45 // Sets |*out| to the hash of the Merkle |tree_leaf|, as defined in RFC6962. | 47 // Sets |*out| to the hash of the Merkle |tree_leaf|, as defined in RFC6962. |
| 46 // Returns true if the hash was generated, false if an error occurred. | 48 // Returns true if the hash was generated, false if an error occurred. |
|
Ryan Sleevi
2016/06/30 22:48:19
Same here - does 6962-bis change this?
Naming wis
Eran Messeri
2016/07/01 13:24:01
(1) Renamed to HashMerkleTreeLeaf (in a separate C
| |
| 47 NET_EXPORT bool Hash(const MerkleTreeLeaf& tree_leaf, std::string* out); | 49 NET_EXPORT bool Hash(const MerkleTreeLeaf& tree_leaf, std::string* out); |
| 48 | 50 |
| 49 } // namespace ct | 51 } // namespace ct |
| 50 | 52 |
| 51 } // namespace net | 53 } // namespace net |
| 52 | 54 |
| 53 #endif // NET_CERT_MERKLE_TREE_LEAF_H_ | 55 #endif // NET_CERT_MERKLE_TREE_LEAF_H_ |
| OLD | NEW |