• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The Chromium Authors
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_CERT_CERT_VERIFY_PROC_BUILTIN_H_
6 #define NET_CERT_CERT_VERIFY_PROC_BUILTIN_H_
7 
8 #include <memory>
9 
10 #include "base/memory/scoped_refptr.h"
11 #include "base/supports_user_data.h"
12 #include "base/time/time.h"
13 #include "net/base/net_export.h"
14 #include "net/der/parse_values.h"
15 #include "third_party/abseil-cpp/absl/types/optional.h"
16 
17 namespace net {
18 
19 class CertNetFetcher;
20 class CertVerifyProc;
21 class CRLSet;
22 class SystemTrustStore;
23 
24 class NET_EXPORT CertVerifyProcBuiltinResultDebugData
25     : public base::SupportsUserData::Data {
26  public:
27   CertVerifyProcBuiltinResultDebugData(
28       base::Time verification_time,
29       const der::GeneralizedTime& der_verification_time,
30       absl::optional<int64_t> chrome_root_store_version);
31 
32   static const CertVerifyProcBuiltinResultDebugData* Get(
33       const base::SupportsUserData* debug_data);
34   static void Create(base::SupportsUserData* debug_data,
35                      base::Time verification_time,
36                      const der::GeneralizedTime& der_verification_time,
37                      absl::optional<int64_t> chrome_root_store_version);
38 
39   // base::SupportsUserData::Data implementation:
40   std::unique_ptr<Data> Clone() override;
41 
verification_time()42   base::Time verification_time() const { return verification_time_; }
der_verification_time()43   const der::GeneralizedTime& der_verification_time() const {
44     return der_verification_time_;
45   }
chrome_root_store_version()46   absl::optional<int64_t> chrome_root_store_version() const {
47     return chrome_root_store_version_;
48   }
49 
50  private:
51   base::Time verification_time_;
52   der::GeneralizedTime der_verification_time_;
53   absl::optional<int64_t> chrome_root_store_version_;
54 };
55 
56 // TODO(crbug.com/649017): This is not how other cert_verify_proc_*.h are
57 // implemented -- they expose the type in the header. Use a consistent style
58 // here too.
59 NET_EXPORT scoped_refptr<CertVerifyProc> CreateCertVerifyProcBuiltin(
60     scoped_refptr<CertNetFetcher> net_fetcher,
61     scoped_refptr<CRLSet> crl_set,
62     std::unique_ptr<SystemTrustStore> system_trust_store);
63 
64 // Returns the time limit used by CertVerifyProcBuiltin. Intended for test use.
65 NET_EXPORT_PRIVATE base::TimeDelta
66 GetCertVerifyProcBuiltinTimeLimitForTesting();
67 
68 }  // namespace net
69 
70 #endif  // NET_CERT_CERT_VERIFY_PROC_BUILTIN_H_
71