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 #ifndef COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ | 5 #ifndef COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ |
6 #define COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ | 6 #define COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <set> | 10 #include <set> |
9 #include <string> | 11 #include <string> |
10 | 12 |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "net/url_request/certificate_report_sender.h" | 15 #include "net/url_request/certificate_report_sender.h" |
14 #include "url/gurl.h" | 16 #include "url/gurl.h" |
15 | 17 |
16 namespace net { | 18 namespace net { |
17 class URLRequestContext; | 19 class URLRequestContext; |
(...skipping 15 matching lines...) Expand all Loading... |
33 ErrorReporter( | 35 ErrorReporter( |
34 net::URLRequestContext* request_context, | 36 net::URLRequestContext* request_context, |
35 const GURL& upload_url, | 37 const GURL& upload_url, |
36 net::CertificateReportSender::CookiesPreference cookies_preference); | 38 net::CertificateReportSender::CookiesPreference cookies_preference); |
37 | 39 |
38 // Allows tests to use a server public key with known private key and | 40 // Allows tests to use a server public key with known private key and |
39 // a mock CertificateReportSender. |server_public_key| must outlive | 41 // a mock CertificateReportSender. |server_public_key| must outlive |
40 // the ErrorReporter. | 42 // the ErrorReporter. |
41 ErrorReporter( | 43 ErrorReporter( |
42 const GURL& upload_url, | 44 const GURL& upload_url, |
43 const uint8 server_public_key[/* 32 */], | 45 const uint8_t server_public_key[/* 32 */], |
44 const uint32 server_public_key_version, | 46 const uint32_t server_public_key_version, |
45 scoped_ptr<net::CertificateReportSender> certificate_report_sender); | 47 scoped_ptr<net::CertificateReportSender> certificate_report_sender); |
46 | 48 |
47 virtual ~ErrorReporter(); | 49 virtual ~ErrorReporter(); |
48 | 50 |
49 // Sends a certificate report to the report collection server. The | 51 // Sends a certificate report to the report collection server. The |
50 // |serialized_report| is expected to be a serialized protobuf | 52 // |serialized_report| is expected to be a serialized protobuf |
51 // containing information about the hostname, certificate chain, and | 53 // containing information about the hostname, certificate chain, and |
52 // certificate errors encountered when validating the chain. | 54 // certificate errors encountered when validating the chain. |
53 // | 55 // |
54 // |SendReport| actually sends the report over the network; callers are | 56 // |SendReport| actually sends the report over the network; callers are |
55 // responsible for enforcing any preconditions (such as obtaining user | 57 // responsible for enforcing any preconditions (such as obtaining user |
56 // opt-in, only sending reports for certain hostnames, checking for | 58 // opt-in, only sending reports for certain hostnames, checking for |
57 // incognito mode, etc.). | 59 // incognito mode, etc.). |
58 // | 60 // |
59 // On some platforms (but not all), ErrorReporter can use | 61 // On some platforms (but not all), ErrorReporter can use |
60 // an HTTP endpoint to send encrypted extended reporting reports. On | 62 // an HTTP endpoint to send encrypted extended reporting reports. On |
61 // unsupported platforms, callers must send extended reporting reports | 63 // unsupported platforms, callers must send extended reporting reports |
62 // over SSL. | 64 // over SSL. |
63 virtual void SendExtendedReportingReport( | 65 virtual void SendExtendedReportingReport( |
64 const std::string& serialized_report); | 66 const std::string& serialized_report); |
65 | 67 |
66 // Whether sending reports over HTTP is supported. | 68 // Whether sending reports over HTTP is supported. |
67 static bool IsHttpUploadUrlSupported(); | 69 static bool IsHttpUploadUrlSupported(); |
68 | 70 |
69 #if defined(USE_OPENSSL) | 71 #if defined(USE_OPENSSL) |
70 // Used by tests. | 72 // Used by tests. |
71 static bool DecryptErrorReport( | 73 static bool DecryptErrorReport( |
72 const uint8 server_private_key[32], | 74 const uint8_t server_private_key[32], |
73 const EncryptedCertLoggerRequest& encrypted_report, | 75 const EncryptedCertLoggerRequest& encrypted_report, |
74 std::string* decrypted_serialized_report); | 76 std::string* decrypted_serialized_report); |
75 #endif | 77 #endif |
76 | 78 |
77 private: | 79 private: |
78 scoped_ptr<net::CertificateReportSender> certificate_report_sender_; | 80 scoped_ptr<net::CertificateReportSender> certificate_report_sender_; |
79 | 81 |
80 const GURL upload_url_; | 82 const GURL upload_url_; |
81 | 83 |
82 const uint8* server_public_key_; | 84 const uint8_t* server_public_key_; |
83 const uint32 server_public_key_version_; | 85 const uint32_t server_public_key_version_; |
84 | 86 |
85 DISALLOW_COPY_AND_ASSIGN(ErrorReporter); | 87 DISALLOW_COPY_AND_ASSIGN(ErrorReporter); |
86 }; | 88 }; |
87 | 89 |
88 } // namespace certificate_reporting | 90 } // namespace certificate_reporting |
89 | 91 |
90 #endif // COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ | 92 #endif // COMPONENTS_CERTIFICATE_REPORTING_CERTIFICATE_ERROR_REPORTER_H_ |
OLD | NEW |