• 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/net_export.h"
13 #include "net/base/x509_cert_types.h"
14 
15 namespace net {
16 
17 class X509Certificate;
18 
19 // SSL connection info.
20 // This is really a struct.  All members are public.
21 class NET_EXPORT SSLInfo {
22  public:
23   SSLInfo();
24   SSLInfo(const SSLInfo& info);
25   ~SSLInfo();
26   SSLInfo& operator=(const SSLInfo& info);
27 
28   void Reset();
29 
is_valid()30   bool is_valid() const { return cert != NULL; }
31 
32   // Adds the specified |error| to the cert status.
33   void SetCertError(int error);
34 
35   // The SSL certificate.
36   scoped_refptr<X509Certificate> cert;
37 
38   // Bitmask of status info of |cert|, representing, for example, known errors
39   // and extended validation (EV) status.
40   // See cert_status_flags.h for values.
41   int cert_status;
42 
43   // The security strength, in bits, of the SSL cipher suite.
44   // 0 means the connection is not encrypted.
45   // -1 means the security strength is unknown.
46   int security_bits;
47 
48   // Information about the SSL connection itself. See
49   // ssl_connection_status_flags.h for values. The protocol version,
50   // ciphersuite, and compression in use are encoded within.
51   int connection_status;
52 
53   // If the certificate is valid, then this is true iff it was rooted at a
54   // standard CA root. (As opposed to a user-installed root.)
55   bool is_issued_by_known_root;
56 
57   // The hashes of the SubjectPublicKeyInfos from each certificate in the chain.
58   std::vector<SHA1Fingerprint> public_key_hashes;
59 };
60 
61 }  // namespace net
62 
63 #endif  // NET_BASE_SSL_INFO_H_
64