OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 NET_SSL_SSL_INFO_H_ | 5 #ifndef NET_SSL_SSL_INFO_H_ |
6 #define NET_SSL_SSL_INFO_H_ | 6 #define NET_SSL_SSL_INFO_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
12 #include "net/cert/cert_status_flags.h" | 12 #include "net/cert/cert_status_flags.h" |
| 13 #include "net/cert/ct_policy_enforcer.h" |
13 #include "net/cert/ct_verify_result.h" | 14 #include "net/cert/ct_verify_result.h" |
14 #include "net/cert/sct_status_flags.h" | 15 #include "net/cert/sct_status_flags.h" |
15 #include "net/cert/x509_cert_types.h" | 16 #include "net/cert/x509_cert_types.h" |
16 #include "net/ssl/signed_certificate_timestamp_and_status.h" | 17 #include "net/ssl/signed_certificate_timestamp_and_status.h" |
17 #include "net/ssl/ssl_config.h" | 18 #include "net/ssl/ssl_config.h" |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 | 21 |
21 class X509Certificate; | 22 class X509Certificate; |
22 | 23 |
23 // SSL connection info. | 24 // SSL connection info. |
24 // This is really a struct. All members are public. | 25 // This is really a struct. All members are public. |
25 class NET_EXPORT SSLInfo { | 26 class NET_EXPORT SSLInfo { |
26 public: | 27 public: |
27 // HandshakeType enumerates the possible resumption cases after an SSL | 28 // HandshakeType enumerates the possible resumption cases after an SSL |
28 // handshake. | 29 // handshake. |
29 enum HandshakeType { | 30 enum HandshakeType { |
30 HANDSHAKE_UNKNOWN = 0, | 31 HANDSHAKE_UNKNOWN = 0, |
31 HANDSHAKE_RESUME, // we resumed a previous session. | 32 HANDSHAKE_RESUME, // we resumed a previous session. |
32 HANDSHAKE_FULL, // we negotiated a new session. | 33 HANDSHAKE_FULL, // we negotiated a new session. |
33 }; | 34 }; |
34 | 35 |
| 36 // Contains information about the Certificate Transparency (CT) |
| 37 // policies that were applied on this connection, whether the |
| 38 // connection complied with these policies, and why |
| 39 // the connection was considered non-compliant, if applicable. |
| 40 struct CTPolicyComplianceDetails { |
| 41 CTPolicyComplianceDetails(); |
| 42 |
| 43 // True if Certificate Transparency policies were applied on this |
| 44 // connection and results were stored in the rest of the fields in |
| 45 // the struct. |
| 46 bool compliance_details_available; |
| 47 |
| 48 // Whether the connection complied with the CT EV policy, and if |
| 49 // not, why not. |
| 50 CTPolicyEnforcer::EVPolicyCompliance ev_policy_compliance; |
| 51 }; |
| 52 |
35 SSLInfo(); | 53 SSLInfo(); |
36 SSLInfo(const SSLInfo& info); | 54 SSLInfo(const SSLInfo& info); |
37 ~SSLInfo(); | 55 ~SSLInfo(); |
38 SSLInfo& operator=(const SSLInfo& info); | 56 SSLInfo& operator=(const SSLInfo& info); |
39 | 57 |
40 void Reset(); | 58 void Reset(); |
41 | 59 |
42 bool is_valid() const { return cert.get() != NULL; } | 60 bool is_valid() const { return cert.get() != NULL; } |
43 | 61 |
44 // Adds the specified |error| to the cert status. | 62 // Adds the specified |error| to the cert status. |
45 void SetCertError(int error); | 63 void SetCertError(int error); |
46 | 64 |
47 // Adds the SignedCertificateTimestamps from ct_verify_result to | 65 // Adds the SignedCertificateTimestamps and policy compliance details |
48 // |signed_certificate_timestamps|. SCTs are held in three separate vectors | 66 // from ct_verify_result to |signed_certificate_timestamps| and |
49 // in ct_verify_result, each vetor representing a particular verification | 67 // |ct_policy_compliance_details|. SCTs are held in three separate |
50 // state, this method associates each of the SCTs with the corresponding | 68 // vectors in ct_verify_result, each vetor representing a particular |
51 // SCTVerifyStatus as it adds it to the |signed_certificate_timestamps| list. | 69 // verification state, this method associates each of the SCTs with |
52 void UpdateSignedCertificateTimestamps( | 70 // the corresponding SCTVerifyStatus as it adds it to the |
| 71 // |signed_certificate_timestamps| list. |
| 72 void UpdateCertificateTransparencyInfo( |
53 const ct::CTVerifyResult& ct_verify_result); | 73 const ct::CTVerifyResult& ct_verify_result); |
54 | 74 |
55 // The SSL certificate. | 75 // The SSL certificate. |
56 scoped_refptr<X509Certificate> cert; | 76 scoped_refptr<X509Certificate> cert; |
57 | 77 |
58 // The SSL certificate as received by the client. Can be different | 78 // The SSL certificate as received by the client. Can be different |
59 // from |cert|, which is the chain as built by the client during | 79 // from |cert|, which is the chain as built by the client during |
60 // validation. | 80 // validation. |
61 scoped_refptr<X509Certificate> unverified_cert; | 81 scoped_refptr<X509Certificate> unverified_cert; |
62 | 82 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 HashValueVector public_key_hashes; | 128 HashValueVector public_key_hashes; |
109 | 129 |
110 // pinning_failure_log contains a message produced by | 130 // pinning_failure_log contains a message produced by |
111 // TransportSecurityState::PKPState::CheckPublicKeyPins in the event of a | 131 // TransportSecurityState::PKPState::CheckPublicKeyPins in the event of a |
112 // pinning failure. It is a (somewhat) human-readable string. | 132 // pinning failure. It is a (somewhat) human-readable string. |
113 std::string pinning_failure_log; | 133 std::string pinning_failure_log; |
114 | 134 |
115 // List of SignedCertificateTimestamps and their corresponding validation | 135 // List of SignedCertificateTimestamps and their corresponding validation |
116 // status. | 136 // status. |
117 SignedCertificateTimestampAndStatusList signed_certificate_timestamps; | 137 SignedCertificateTimestampAndStatusList signed_certificate_timestamps; |
| 138 |
| 139 // Details about the Certificate Transparency policies that were |
| 140 // applied to this connection. Be sure to check the |
| 141 // |compliance_details_available| field inside before using any of the |
| 142 // other fields, because information about CT policies might not be |
| 143 // available (for example, because this SSLInfo was serialized without |
| 144 // storing the CT policy details and subsequently deserialized). |
| 145 CTPolicyComplianceDetails ct_policy_compliance_details; |
118 }; | 146 }; |
119 | 147 |
120 } // namespace net | 148 } // namespace net |
121 | 149 |
122 #endif // NET_SSL_SSL_INFO_H_ | 150 #endif // NET_SSL_SSL_INFO_H_ |
OLD | NEW |