| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ct_log_response_parser.h" | 5 #include "net/cert/ct_log_response_parser.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_value_converter.h" | 9 #include "base/json/json_value_converter.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 return false; | 120 return false; |
| 121 } | 121 } |
| 122 | 122 |
| 123 if (!IsJsonSTHStructurallyValid(parsed_sth)) | 123 if (!IsJsonSTHStructurallyValid(parsed_sth)) |
| 124 return false; | 124 return false; |
| 125 | 125 |
| 126 signed_tree_head->version = SignedTreeHead::V1; | 126 signed_tree_head->version = SignedTreeHead::V1; |
| 127 signed_tree_head->tree_size = parsed_sth.tree_size; | 127 signed_tree_head->tree_size = parsed_sth.tree_size; |
| 128 signed_tree_head->timestamp = | 128 signed_tree_head->timestamp = |
| 129 base::Time::UnixEpoch() + | 129 base::Time::UnixEpoch() + |
| 130 base::TimeDelta::FromMilliseconds(parsed_sth.timestamp); | 130 base::TimeDelta::FromMilliseconds( |
| 131 static_cast<int64>(parsed_sth.timestamp)); |
| 131 signed_tree_head->signature = parsed_sth.signature; | 132 signed_tree_head->signature = parsed_sth.signature; |
| 132 memcpy(signed_tree_head->sha256_root_hash, | 133 memcpy(signed_tree_head->sha256_root_hash, |
| 133 parsed_sth.sha256_root_hash.c_str(), | 134 parsed_sth.sha256_root_hash.c_str(), |
| 134 kSthRootHashLength); | 135 kSthRootHashLength); |
| 135 return true; | 136 return true; |
| 136 } | 137 } |
| 137 | 138 |
| 138 } // namespace ct | 139 } // namespace ct |
| 139 | 140 |
| 140 } // namespace net | 141 } // namespace net |
| OLD | NEW |