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. |
| 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. |
| 24 struct NET_EXPORT MerkleTreeLeaf { | 24 struct NET_EXPORT MerkleTreeLeaf { |
| 25 MerkleTreeLeaf(); | 25 MerkleTreeLeaf(); |
| 26 MerkleTreeLeaf(const MerkleTreeLeaf& other); | |
|
Rob Percival
2016/05/26 17:33:15
Why define a copy constructor?
Eran Messeri
2016/06/30 19:58:28
The compiler produces an error about "Complex clas
| |
| 26 ~MerkleTreeLeaf(); | 27 ~MerkleTreeLeaf(); |
| 27 | 28 |
| 28 // The log id this leaf belongs to. | 29 // The log id this leaf belongs to. |
| 29 std::string log_id; | 30 std::string log_id; |
| 30 | 31 |
| 31 // Certificate / Precertificate and indication of entry type. | 32 // Certificate / Precertificate and indication of entry type. |
| 32 LogEntry log_entry; | 33 LogEntry log_entry; |
| 33 | 34 |
| 34 // Timestamp from the SCT. | 35 // Timestamp from the SCT. |
| 35 base::Time timestamp; | 36 base::Time timestamp; |
| 36 | 37 |
| 37 // Extensions from the SCT. | 38 // Extensions from the SCT. |
| 38 std::string extensions; | 39 std::string extensions; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert, | 42 NET_EXPORT bool GetMerkleTreeLeaf(const X509Certificate* cert, |
| 42 const SignedCertificateTimestamp* sct, | 43 const SignedCertificateTimestamp* sct, |
| 43 MerkleTreeLeaf* merkle_tree_leaf); | 44 MerkleTreeLeaf* merkle_tree_leaf); |
| 44 | 45 |
| 45 // Sets |*out| to the hash of the Merkle |tree_leaf|, as defined in RFC6962. | 46 // 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. | 47 // Returns true if the hash was generated, false if an error occurred. |
| 47 NET_EXPORT bool Hash(const MerkleTreeLeaf& tree_leaf, std::string* out); | 48 NET_EXPORT bool Hash(const MerkleTreeLeaf& tree_leaf, std::string* out); |
| 48 | 49 |
| 49 } // namespace ct | 50 } // namespace ct |
| 50 | 51 |
| 51 } // namespace net | 52 } // namespace net |
| 52 | 53 |
| 53 #endif // NET_CERT_MERKLE_TREE_LEAF_H_ | 54 #endif // NET_CERT_MERKLE_TREE_LEAF_H_ |
| OLD | NEW |