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