OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BASE_SSL_INFO_H_ | 5 #ifndef NET_BASE_SSL_INFO_H_ |
6 #define NET_BASE_SSL_INFO_H_ | 6 #define NET_BASE_SSL_INFO_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "base/string16.h" |
9 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
10 | 11 |
11 namespace net { | 12 namespace net { |
12 | 13 |
13 class X509Certificate; | 14 class X509Certificate; |
14 | 15 |
15 // SSL connection info. | 16 // SSL connection info. |
16 // This is really a struct. All members are public. | 17 // This is really a struct. All members are public. |
17 class SSLInfo { | 18 class SSLInfo { |
18 public: | 19 public: |
19 SSLInfo(); | 20 SSLInfo(); |
20 SSLInfo(const SSLInfo& info); | 21 SSLInfo(const SSLInfo& info); |
21 ~SSLInfo(); | 22 ~SSLInfo(); |
22 SSLInfo& operator=(const SSLInfo& info); | 23 SSLInfo& operator=(const SSLInfo& info); |
23 | 24 |
24 void Reset(); | 25 void Reset(); |
25 | 26 |
26 bool is_valid() const { return cert != NULL; } | 27 bool is_valid() const { return cert != NULL || !tls_username.empty(); } |
27 | 28 |
28 // Adds the specified |error| to the cert status. | 29 // Adds the specified |error| to the cert status. |
29 void SetCertError(int error); | 30 void SetCertError(int error); |
30 | 31 |
31 // The SSL certificate. | 32 // The SSL certificate. |
32 scoped_refptr<X509Certificate> cert; | 33 scoped_refptr<X509Certificate> cert; |
33 | 34 |
| 35 // The TLS username, or the empty string "" if TLS login auth wasn't used. |
| 36 string16 tls_username; |
| 37 |
34 // Bitmask of status info of |cert|, representing, for example, known errors | 38 // Bitmask of status info of |cert|, representing, for example, known errors |
35 // and extended validation (EV) status. | 39 // and extended validation (EV) status. |
36 // See cert_status_flags.h for values. | 40 // See cert_status_flags.h for values. |
37 int cert_status; | 41 int cert_status; |
38 | 42 |
39 // The security strength, in bits, of the SSL cipher suite. | 43 // The security strength, in bits, of the SSL cipher suite. |
40 // 0 means the connection is not encrypted. | 44 // 0 means the connection is not encrypted. |
41 // -1 means the security strength is unknown. | 45 // -1 means the security strength is unknown. |
42 int security_bits; | 46 int security_bits; |
43 | 47 |
44 // Information about the SSL connection itself. See | 48 // Information about the SSL connection itself. See |
45 // ssl_connection_status_flags.h for values. The protocol version, | 49 // ssl_connection_status_flags.h for values. The protocol version, |
46 // ciphersuite, and compression in use are encoded within. | 50 // ciphersuite, and compression in use are encoded within. |
47 int connection_status; | 51 int connection_status; |
48 }; | 52 }; |
49 | 53 |
50 } // namespace net | 54 } // namespace net |
51 | 55 |
52 #endif // NET_BASE_SSL_INFO_H_ | 56 #endif // NET_BASE_SSL_INFO_H_ |
OLD | NEW |