summaryrefslogtreecommitdiff
path: root/chromium/net/cert/cert_verify_result.h
blob: e93d8b06841c6c965b538bbf5502d82c5eebde96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_CERT_CERT_VERIFY_RESULT_H_
#define NET_CERT_CERT_VERIFY_RESULT_H_

#include <vector>

#include "base/memory/ref_counted.h"
#include "net/base/net_export.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/x509_cert_types.h"

namespace net {

class X509Certificate;

// The result of certificate verification.
class NET_EXPORT CertVerifyResult {
 public:
  CertVerifyResult();
  CertVerifyResult(const CertVerifyResult& other);
  ~CertVerifyResult();

  void Reset();

  bool operator==(const CertVerifyResult& other) const;

  // The certificate and chain that was constructed during verification.
  // Note that the though the verified certificate will match the originally
  // supplied certificate, the intermediate certificates stored within may
  // be substantially different. In the event of a verification failure, this
  // will contain the chain as supplied by the server. This may be NULL if
  // running within the sandbox.
  scoped_refptr<X509Certificate> verified_cert;

  // Bitmask of CERT_STATUS_* from net/cert/cert_status_flags.h. Note that
  // these status flags apply to the certificate chain returned in
  // |verified_cert|, rather than the originally supplied certificate
  // chain.
  CertStatus cert_status;

  // Properties of the certificate chain.
  bool has_md2;
  bool has_md4;
  bool has_md5;
  bool has_sha1;
  bool has_sha1_leaf;

  // If the certificate was successfully verified then this contains the
  // hashes, in several hash algorithms, of the SubjectPublicKeyInfos of the
  // chain.
  HashValueVector public_key_hashes;

  // is_issued_by_known_root is true if we recognise the root CA as a standard
  // root.  If it isn't then it's probably the case that this certificate was
  // generated by a MITM proxy whose root has been installed locally. This is
  // meaningless if the certificate was not trusted.
  bool is_issued_by_known_root;

  // is_issued_by_additional_trust_anchor is true if the root CA used for this
  // verification came from the list of additional trust anchors.
  bool is_issued_by_additional_trust_anchor;

  // True if a fallback to the common name was used when matching the host
  // name, rather than using the subjectAltName.
  bool common_name_fallback_used;
};

}  // namespace net

#endif  // NET_CERT_CERT_VERIFY_RESULT_H_