OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/net/certificate_error_reporter.h" | 5 #include "chrome/browser/net/certificate_error_reporter.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/net/encrypted_cert_logger.pb.h" | 10 #include "chrome/browser/net/encrypted_cert_logger.pb.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 LOG(ERROR) << "Failed to encrypt serialized report."; | 138 LOG(ERROR) << "Failed to encrypt serialized report."; |
139 return; | 139 return; |
140 } | 140 } |
141 std::string serialized_encrypted_report; | 141 std::string serialized_encrypted_report; |
142 encrypted_report.SerializeToString(&serialized_encrypted_report); | 142 encrypted_report.SerializeToString(&serialized_encrypted_report); |
143 certificate_report_sender_->Send(upload_url_, serialized_encrypted_report); | 143 certificate_report_sender_->Send(upload_url_, serialized_encrypted_report); |
144 #endif | 144 #endif |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 void CertificateErrorReporter::SendPinningViolationReport( | |
149 const std::string& serialized_report) { | |
150 certificate_report_sender_->Send(upload_url_, serialized_report); | |
151 } | |
152 | |
153 bool CertificateErrorReporter::IsHttpUploadUrlSupported() { | 148 bool CertificateErrorReporter::IsHttpUploadUrlSupported() { |
154 #if defined(USE_OPENSSL) | 149 #if defined(USE_OPENSSL) |
155 return true; | 150 return true; |
156 #else | 151 #else |
157 return false; | 152 return false; |
158 #endif | 153 #endif |
159 } | 154 } |
160 | 155 |
161 // Used only by tests. | 156 // Used only by tests. |
162 #if defined(USE_OPENSSL) | 157 #if defined(USE_OPENSSL) |
(...skipping 10 matching lines...) Expand all Loading... |
173 | 168 |
174 // Use an all-zero nonce because the key is random per-message. | 169 // Use an all-zero nonce because the key is random per-message. |
175 std::string nonce(aead.NonceLength(), 0); | 170 std::string nonce(aead.NonceLength(), 0); |
176 | 171 |
177 return aead.Open(encrypted_report.encrypted_report(), nonce, std::string(), | 172 return aead.Open(encrypted_report.encrypted_report(), nonce, std::string(), |
178 decrypted_serialized_report); | 173 decrypted_serialized_report); |
179 } | 174 } |
180 #endif | 175 #endif |
181 | 176 |
182 } // namespace chrome_browser_net | 177 } // namespace chrome_browser_net |
OLD | NEW |