| 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 #include "net/cert/signed_tree_head.h" | 5 #include "net/cert/signed_tree_head.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 const DigitallySigned& signature, | 22 const DigitallySigned& signature, |
| 23 const std::string& log_id) | 23 const std::string& log_id) |
| 24 : version(version), | 24 : version(version), |
| 25 timestamp(timestamp), | 25 timestamp(timestamp), |
| 26 tree_size(tree_size), | 26 tree_size(tree_size), |
| 27 signature(signature), | 27 signature(signature), |
| 28 log_id(log_id) { | 28 log_id(log_id) { |
| 29 memcpy(this->sha256_root_hash, sha256_root_hash, kSthRootHashLength); | 29 memcpy(this->sha256_root_hash, sha256_root_hash, kSthRootHashLength); |
| 30 } | 30 } |
| 31 | 31 |
| 32 SignedTreeHead::SignedTreeHead(const SignedTreeHead& other) = default; |
| 33 |
| 32 SignedTreeHead::~SignedTreeHead() {} | 34 SignedTreeHead::~SignedTreeHead() {} |
| 33 | 35 |
| 34 void PrintTo(const SignedTreeHead& sth, std::ostream* os) { | 36 void PrintTo(const SignedTreeHead& sth, std::ostream* os) { |
| 35 (*os) << "{\n" | 37 (*os) << "{\n" |
| 36 << "\t\"version\": " << sth.version << ",\n" | 38 << "\t\"version\": " << sth.version << ",\n" |
| 37 << "\t\"timestamp\": " << sth.timestamp << ",\n" | 39 << "\t\"timestamp\": " << sth.timestamp << ",\n" |
| 38 << "\t\"tree_size\": " << sth.tree_size << ",\n" | 40 << "\t\"tree_size\": " << sth.tree_size << ",\n" |
| 39 << "\t\"sha256_root_hash\": \"" | 41 << "\t\"sha256_root_hash\": \"" |
| 40 << base::HexEncode(sth.sha256_root_hash, kSthRootHashLength) | 42 << base::HexEncode(sth.sha256_root_hash, kSthRootHashLength) |
| 41 << "\",\n\t\"log_id\": \"" | 43 << "\",\n\t\"log_id\": \"" |
| 42 << base::HexEncode(sth.log_id.data(), sth.log_id.size()) << "\"\n" | 44 << base::HexEncode(sth.log_id.data(), sth.log_id.size()) << "\"\n" |
| 43 << "}"; | 45 << "}"; |
| 44 } | 46 } |
| 45 | 47 |
| 46 } // namespace ct | 48 } // namespace ct |
| 47 } // namespace net | 49 } // namespace net |
| OLD | NEW |