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. This field might be false because, for example, no | |
46 // CTPolicyEnforcer was in use when the connection was set up, or | |
47 // because this SSLInfo was serialized and deserialized without | |
48 // storing the compliance information. | |
Ryan Sleevi
2016/02/05 02:09:25
The 'for example' feels like it's documenting impl
estark
2016/02/08 08:36:26
I suppose so. I wanted to make it clear that false
| |
49 bool compliance_details_available; | |
50 | |
51 // Whether the connection complied with the CT EV policy, and if | |
52 // not, why not. | |
53 CTPolicyEnforcer::EVPolicyCompliance ev_policy_compliance; | |
54 }; | |
55 | |
35 SSLInfo(); | 56 SSLInfo(); |
36 SSLInfo(const SSLInfo& info); | 57 SSLInfo(const SSLInfo& info); |
37 ~SSLInfo(); | 58 ~SSLInfo(); |
38 SSLInfo& operator=(const SSLInfo& info); | 59 SSLInfo& operator=(const SSLInfo& info); |
39 | 60 |
40 void Reset(); | 61 void Reset(); |
41 | 62 |
42 bool is_valid() const { return cert.get() != NULL; } | 63 bool is_valid() const { return cert.get() != NULL; } |
43 | 64 |
44 // Adds the specified |error| to the cert status. | 65 // Adds the specified |error| to the cert status. |
45 void SetCertError(int error); | 66 void SetCertError(int error); |
46 | 67 |
47 // Adds the SignedCertificateTimestamps from ct_verify_result to | 68 // Adds the SignedCertificateTimestamps and policy compliance details |
48 // |signed_certificate_timestamps|. SCTs are held in three separate vectors | 69 // from ct_verify_result to |signed_certificate_timestamps| and |
49 // in ct_verify_result, each vetor representing a particular verification | 70 // |ct_policy_compliance_details|. SCTs are held in three separate |
50 // state, this method associates each of the SCTs with the corresponding | 71 // vectors in ct_verify_result, each vetor representing a particular |
51 // SCTVerifyStatus as it adds it to the |signed_certificate_timestamps| list. | 72 // verification state, this method associates each of the SCTs with |
52 void UpdateSignedCertificateTimestamps( | 73 // the corresponding SCTVerifyStatus as it adds it to the |
74 // |signed_certificate_timestamps| list. | |
75 void UpdateCertificateTransparencyInfo( | |
53 const ct::CTVerifyResult& ct_verify_result); | 76 const ct::CTVerifyResult& ct_verify_result); |
54 | 77 |
55 // The SSL certificate. | 78 // The SSL certificate. |
56 scoped_refptr<X509Certificate> cert; | 79 scoped_refptr<X509Certificate> cert; |
57 | 80 |
58 // The SSL certificate as received by the client. Can be different | 81 // The SSL certificate as received by the client. Can be different |
59 // from |cert|, which is the chain as built by the client during | 82 // from |cert|, which is the chain as built by the client during |
60 // validation. | 83 // validation. |
61 scoped_refptr<X509Certificate> unverified_cert; | 84 scoped_refptr<X509Certificate> unverified_cert; |
62 | 85 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 HashValueVector public_key_hashes; | 131 HashValueVector public_key_hashes; |
109 | 132 |
110 // pinning_failure_log contains a message produced by | 133 // pinning_failure_log contains a message produced by |
111 // TransportSecurityState::PKPState::CheckPublicKeyPins in the event of a | 134 // TransportSecurityState::PKPState::CheckPublicKeyPins in the event of a |
112 // pinning failure. It is a (somewhat) human-readable string. | 135 // pinning failure. It is a (somewhat) human-readable string. |
113 std::string pinning_failure_log; | 136 std::string pinning_failure_log; |
114 | 137 |
115 // List of SignedCertificateTimestamps and their corresponding validation | 138 // List of SignedCertificateTimestamps and their corresponding validation |
116 // status. | 139 // status. |
117 SignedCertificateTimestampAndStatusList signed_certificate_timestamps; | 140 SignedCertificateTimestampAndStatusList signed_certificate_timestamps; |
141 | |
142 // Details about the Certificate Transparency policies that were | |
143 // applied to this connection. Be sure to check the | |
144 // |compliance_details_available| field inside before using any of the | |
145 // other fields, because information about CT policies might not be | |
146 // available (for example, because this SSLInfo was serialized without | |
147 // storing the CT policy details and subsequently deserialized). | |
148 CTPolicyComplianceDetails ct_policy_compliance_details; | |
118 }; | 149 }; |
119 | 150 |
120 } // namespace net | 151 } // namespace net |
121 | 152 |
122 #endif // NET_SSL_SSL_INFO_H_ | 153 #endif // NET_SSL_SSL_INFO_H_ |
OLD | NEW |