Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 7 |
| 8 #include "net/base/cert_status_flags.h" | 8 #include "net/base/cert_status_flags.h" |
| 9 #include "net/base/x509_certificate.h" | 9 #include "net/base/x509_certificate.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 | 12 |
| 13 // SSL connection info. | 13 // SSL connection info. |
| 14 // This is really a struct. All members are public. | 14 // This is really a struct. All members are public. |
| 15 class SSLInfo { | 15 class SSLInfo { |
| 16 public: | 16 public: |
| 17 SSLInfo() : cert_status(0), security_bits(-1) { } | 17 SSLInfo() : cert_status(0), security_bits(-1), |
| 18 next_proto_status(kNextProtoUnsupported) { } | |
| 18 | 19 |
| 19 void Reset() { | 20 void Reset() { |
| 20 cert = NULL; | 21 cert = NULL; |
| 21 security_bits = -1; | 22 security_bits = -1; |
| 22 cert_status = 0; | 23 cert_status = 0; |
| 24 next_proto.clear(); | |
| 25 next_proto_status = kNextProtoUnsupported; | |
| 23 } | 26 } |
| 24 | 27 |
| 25 bool is_valid() const { return cert != NULL; } | 28 bool is_valid() const { return cert != NULL; } |
| 26 | 29 |
| 27 // Adds the specified |error| to the cert status. | 30 // Adds the specified |error| to the cert status. |
| 28 void SetCertError(int error) { | 31 void SetCertError(int error) { |
| 29 cert_status |= MapNetErrorToCertStatus(error); | 32 cert_status |= MapNetErrorToCertStatus(error); |
| 30 } | 33 } |
| 31 | 34 |
| 32 // The SSL certificate. | 35 // The SSL certificate. |
| 33 scoped_refptr<X509Certificate> cert; | 36 scoped_refptr<X509Certificate> cert; |
| 34 | 37 |
| 35 // Bitmask of status info of |cert|, representing, for example, known errors | 38 // Bitmask of status info of |cert|, representing, for example, known errors |
| 36 // and extended validation (EV) status. | 39 // and extended validation (EV) status. |
| 37 // See cert_status_flags.h for values. | 40 // See cert_status_flags.h for values. |
| 38 int cert_status; | 41 int cert_status; |
| 39 | 42 |
| 40 // The security strength, in bits, of the SSL cipher suite. | 43 // The security strength, in bits, of the SSL cipher suite. |
| 41 // 0 means the connection is not encrypted. | 44 // 0 means the connection is not encrypted. |
| 42 // -1 means the security strength is unknown. | 45 // -1 means the security strength is unknown. |
| 43 int security_bits; | 46 int security_bits; |
| 47 | |
| 48 // Next Protocol Negotiation (NPN) allows a TLS client and server to come to | |
| 49 // an agreement about the application level protocol to speak over a | |
| 50 // connection. See also the next_protos field in SSLConfig. | |
| 51 enum NextProtoStatus { | |
|
willchan no longer on Chromium
2009/11/25 19:48:13
enums should go first in the class definition:
htt
agl
2009/11/30 20:24:53
Done.
| |
| 52 kNextProtoUnsupported = 0, // The server doesn't support NPN. | |
| 53 kNextProtoNegotiated = 1, // We agreed on a protocol, see next_proto | |
| 54 kNextProtoNoOverlap = 2, // No protocols in common. We requested | |
| 55 // |next_proto|. | |
| 56 }; | |
| 57 | |
| 58 NextProtoStatus next_proto_status; // One of kNextProto* | |
| 59 std::string next_proto; // The negotiated protocol, if any. | |
|
willchan no longer on Chromium
2009/11/25 19:48:13
You should #include <string> for this.
agl
2009/11/30 20:24:53
Done.
| |
| 44 }; | 60 }; |
| 45 | 61 |
| 46 } // namespace net | 62 } // namespace net |
| 47 | 63 |
| 48 #endif // NET_BASE_SSL_INFO_H_ | 64 #endif // NET_BASE_SSL_INFO_H_ |
| OLD | NEW |