• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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 #pragma once
8 
9 #include <vector>
10 
11 #include "base/memory/ref_counted.h"
12 #include "net/base/x509_cert_types.h"
13 
14 namespace net {
15 
16 class X509Certificate;
17 
18 // SSL connection info.
19 // This is really a struct.  All members are public.
20 class SSLInfo {
21  public:
22   SSLInfo();
23   SSLInfo(const SSLInfo& info);
24   ~SSLInfo();
25   SSLInfo& operator=(const SSLInfo& info);
26 
27   void Reset();
28 
is_valid()29   bool is_valid() const { return cert != NULL; }
30 
31   // Adds the specified |error| to the cert status.
32   void SetCertError(int error);
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   // Information about the SSL connection itself. See
48   // ssl_connection_status_flags.h for values. The protocol version,
49   // ciphersuite, and compression in use are encoded within.
50   int connection_status;
51 
52   // If the certificate is valid, then this is true iff it was rooted at a
53   // standard CA root. (As opposed to a user-installed root.)
54   bool is_issued_by_known_root;
55 
56   // The hashes of the SubjectPublicKeyInfos from each certificate in the chain.
57   std::vector<SHA1Fingerprint> public_key_hashes;
58 };
59 
60 }  // namespace net
61 
62 #endif  // NET_BASE_SSL_INFO_H_
63