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 3 // found in the LICENSE file. 4 5 #ifndef NET_BASE_SSL_INFO_H_ 6 #define NET_BASE_SSL_INFO_H_ 7 8 #include <string> 9 10 #include "net/base/cert_status_flags.h" 11 #include "net/base/x509_certificate.h" 12 13 namespace net { 14 15 // SSL connection info. 16 // This is really a struct. All members are public. 17 class SSLInfo { 18 public: 19 SSLInfo() : cert_status(0), security_bits(-1) { } 20 21 void Reset() { 22 cert = NULL; 23 security_bits = -1; 24 cert_status = 0; 25 } 26 27 bool is_valid() const { return cert != NULL; } 28 29 // Adds the specified |error| to the cert status. 30 void SetCertError(int error) { 31 cert_status |= MapNetErrorToCertStatus(error); 32 } 33 34 // The SSL certificate. 35 scoped_refptr<X509Certificate> cert; 36 37 // Bitmask of status info of |cert|, representing, for example, known errors 38 // and extended validation (EV) status. 39 // See cert_status_flags.h for values. 40 int cert_status; 41 42 // The security strength, in bits, of the SSL cipher suite. 43 // 0 means the connection is not encrypted. 44 // -1 means the security strength is unknown. 45 int security_bits; 46 }; 47 48 } // namespace net 49 50 #endif // NET_BASE_SSL_INFO_H_ 51