Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: net/cert/internal/system_trust_store.h

Issue 2829783002: [refactor] Extract the platform-specific TrustStore instantiations and (Closed)
Patch Set: delete bad comment Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/cert/cert_verify_proc_builtin.cc ('k') | net/cert/internal/system_trust_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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_CERT_INTERNAL_SYSTEM_TRUST_STORE_H_
6 #define NET_CERT_INTERNAL_SYSTEM_TRUST_STORE_H_
7
8 #include <vector>
9
10 #include "base/memory/ref_counted.h"
11 #include "net/base/net_export.h"
12 #include "net/cert/internal/parsed_certificate.h"
13
14 namespace net {
15
16 class TrustStore;
17 class CertIssuerSource;
18 class TrustAnchor;
19
20 // The SystemTrustStore interface is used to encapsulate a TrustStore for the
21 // current platform, with some extra bells and whistles.
22 //
23 // This is primarily used to abstract out the platform-specific bits that
24 // relate to configuring the TrustStore needed for path building.
25 //
26 // Implementations of SystemTrustStore create an effective trust
27 // store that is the composition of:
28 //
29 // * The platform-specific trust store
30 // * A set of manually added trust anchors
31 // * Test certificates added via ScopedTestRoot
32 class SystemTrustStore {
33 public:
34 virtual ~SystemTrustStore() {}
35
36 // Returns an aggregate TrustStore that can be used by the path builder. The
37 // store composes the system trust store (if implemented) with manually added
38 // trust anchors added via AddTrustAnchor(). This pointer is non-owned, and
39 // valid only for the lifetime of |this|.
40 virtual TrustStore* GetTrustStore() = 0;
41
42 // Returns false if the implementation of SystemTrustStore doesn't actually
43 // make use of the system's trust store. This might be the case for
44 // unsupported platforms. In the case where this returns false, the trust
45 // store returned by GetTrustStore() is made up solely of the manually added
46 // trust anchors (via AddTrustAnchor()).
47 virtual bool UsesSystemTrustStore() const = 0;
48
49 // TODO(eroman): Expose this through the TrustStore interface instead?
50 //
51 // Returns a CertIssuerSource that finds any intermediates that are present in
52 // the system trust store. These intermediates are not necessarily trusted,
53 // however may be used during path building as another means of finding
54 // certificates. If the implementation of SystemTrustStore doesn't support
55 // this feature may return nullptr.
56 virtual CertIssuerSource* GetCertIssuerSource() = 0;
57
58 // IsKnownRoot() returns true if the given trust anchor originated from the
59 // system trust store and is a "standard" one. The meaning of "standard" is
60 // that it is one of default trust anchors for the system, as opposed to a
61 // user-installed one. IsKnownRoot() is only guaranteed to work for
62 // TrustAnchors returned by GetTrustStore().
63 virtual bool IsKnownRoot(
64 const scoped_refptr<TrustAnchor>& trust_anchor) const = 0;
65
66 // Adds a trust anchor to this particular instance of SystemTrustStore, and
67 // not globally for the system.
68 virtual void AddTrustAnchor(
69 const scoped_refptr<TrustAnchor>& trust_anchor) = 0;
70
71 // Returns true if |trust_anchor| was one added via |AddTrustAnchor()|. This
72 // is only guaranteed to work if |trust_anchor| was one returned by
73 // GetTrustStore(), as it may be implemented by pointer comparison rather than
74 // SPKI comparison.
75 virtual bool IsAdditionalTrustAnchor(
76 const scoped_refptr<TrustAnchor>& trust_anchor) const = 0;
77 };
78
79 // Creates an instance of SystemTrustStore that wraps the current platform's SSL
80 // trust store. This canno return nullptr, even in the case where system trust
81 // store integration is not supported. In this latter case, the SystemTrustStore
82 // will only give access to the manually added trust anchors. This can be
83 // inspected by testing whether UsesSystemTrustStore() returns false.
84 NET_EXPORT std::unique_ptr<SystemTrustStore> CreateSslSystemTrustStore();
85
86 } // namespace net
87
88 #endif // NET_CERT_INTERNAL_SYSTEM_TRUST_STORE_H_
OLDNEW
« no previous file with comments | « net/cert/cert_verify_proc_builtin.cc ('k') | net/cert/internal/system_trust_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698