| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_signed_certificate_timestamp_log_param.h" | 5 #include "net/cert/ct_signed_certificate_timestamp_log_param.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/base64.h" | 11 #include "base/base64.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "net/cert/ct_sct_to_string.h" | 15 #include "net/cert/ct_sct_to_string.h" |
| 16 #include "net/cert/ct_verify_result.h" | |
| 17 #include "net/cert/signed_certificate_timestamp.h" | 16 #include "net/cert/signed_certificate_timestamp.h" |
| 18 #include "net/log/net_log_capture_mode.h" | 17 #include "net/log/net_log_capture_mode.h" |
| 19 | 18 |
| 20 namespace net { | 19 namespace net { |
| 21 | 20 |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 // Base64 encode the given |value| string and put it in |dict| with the | 23 // Base64 encode the given |value| string and put it in |dict| with the |
| 25 // description |key|. | 24 // description |key|. |
| 26 void SetBinaryData( | 25 void SetBinaryData( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 for (const auto& sct_and_status : sct_and_status_list) | 68 for (const auto& sct_and_status : sct_and_status_list) |
| 70 output_scts->Append( | 69 output_scts->Append( |
| 71 SCTToDictionary(*(sct_and_status.sct.get()), sct_and_status.status)); | 70 SCTToDictionary(*(sct_and_status.sct.get()), sct_and_status.status)); |
| 72 | 71 |
| 73 return output_scts; | 72 return output_scts; |
| 74 } | 73 } |
| 75 | 74 |
| 76 } // namespace | 75 } // namespace |
| 77 | 76 |
| 78 std::unique_ptr<base::Value> NetLogSignedCertificateTimestampCallback( | 77 std::unique_ptr<base::Value> NetLogSignedCertificateTimestampCallback( |
| 79 const ct::CTVerifyResult* ct_result, | 78 const SignedCertificateTimestampAndStatusList* scts, |
| 80 NetLogCaptureMode capture_mode) { | 79 NetLogCaptureMode capture_mode) { |
| 81 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 80 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 82 | 81 |
| 83 dict->Set("scts", SCTListToPrintableValues(ct_result->scts)); | 82 dict->Set("scts", SCTListToPrintableValues(*scts)); |
| 84 | 83 |
| 85 return std::move(dict); | 84 return std::move(dict); |
| 86 } | 85 } |
| 87 | 86 |
| 88 std::unique_ptr<base::Value> NetLogRawSignedCertificateTimestampCallback( | 87 std::unique_ptr<base::Value> NetLogRawSignedCertificateTimestampCallback( |
| 89 const std::string* embedded_scts, | 88 const std::string* embedded_scts, |
| 90 const std::string* sct_list_from_ocsp, | 89 const std::string* sct_list_from_ocsp, |
| 91 const std::string* sct_list_from_tls_extension, | 90 const std::string* sct_list_from_tls_extension, |
| 92 NetLogCaptureMode capture_mode) { | 91 NetLogCaptureMode capture_mode) { |
| 93 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 92 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 94 | 93 |
| 95 SetBinaryData("embedded_scts", *embedded_scts, dict.get()); | 94 SetBinaryData("embedded_scts", *embedded_scts, dict.get()); |
| 96 SetBinaryData("scts_from_ocsp_response", *sct_list_from_ocsp, dict.get()); | 95 SetBinaryData("scts_from_ocsp_response", *sct_list_from_ocsp, dict.get()); |
| 97 SetBinaryData("scts_from_tls_extension", *sct_list_from_tls_extension, | 96 SetBinaryData("scts_from_tls_extension", *sct_list_from_tls_extension, |
| 98 dict.get()); | 97 dict.get()); |
| 99 | 98 |
| 100 return std::move(dict); | 99 return std::move(dict); |
| 101 } | 100 } |
| 102 | 101 |
| 103 } // namespace net | 102 } // namespace net |
| OLD | NEW |