OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_CERT_INTERNAL_SYSTEM_TRUST_STORE_H_ | 5 #ifndef NET_CERT_INTERNAL_SYSTEM_TRUST_STORE_H_ |
6 #define NET_CERT_INTERNAL_SYSTEM_TRUST_STORE_H_ | 6 #define NET_CERT_INTERNAL_SYSTEM_TRUST_STORE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
12 #include "net/cert/internal/parsed_certificate.h" | 12 #include "net/cert/internal/parsed_certificate.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 class TrustStore; | 16 class TrustStore; |
17 class CertIssuerSource; | |
18 class TrustAnchor; | 17 class TrustAnchor; |
19 | 18 |
20 // The SystemTrustStore interface is used to encapsulate a TrustStore for the | 19 // The SystemTrustStore interface is used to encapsulate a TrustStore for the |
21 // current platform, with some extra bells and whistles. | 20 // current platform, with some extra bells and whistles. |
22 // | 21 // |
23 // This is primarily used to abstract out the platform-specific bits that | 22 // This is primarily used to abstract out the platform-specific bits that |
24 // relate to configuring the TrustStore needed for path building. | 23 // relate to configuring the TrustStore needed for path building. |
25 // | 24 // |
26 // Implementations of SystemTrustStore create an effective trust | 25 // Implementations of SystemTrustStore create an effective trust |
27 // store that is the composition of: | 26 // store that is the composition of: |
(...skipping 11 matching lines...) Expand all Loading... |
39 // valid only for the lifetime of |this|. | 38 // valid only for the lifetime of |this|. |
40 virtual TrustStore* GetTrustStore() = 0; | 39 virtual TrustStore* GetTrustStore() = 0; |
41 | 40 |
42 // Returns false if the implementation of SystemTrustStore doesn't actually | 41 // 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 | 42 // 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 | 43 // unsupported platforms. In the case where this returns false, the trust |
45 // store returned by GetTrustStore() is made up solely of the manually added | 44 // store returned by GetTrustStore() is made up solely of the manually added |
46 // trust anchors (via AddTrustAnchor()). | 45 // trust anchors (via AddTrustAnchor()). |
47 virtual bool UsesSystemTrustStore() const = 0; | 46 virtual bool UsesSystemTrustStore() const = 0; |
48 | 47 |
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 | 48 // 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 | 49 // 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 | 50 // 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 | 51 // user-installed one. IsKnownRoot() is only guaranteed to work for |
62 // TrustAnchors returned by GetTrustStore(). | 52 // TrustAnchors returned by GetTrustStore(). |
63 virtual bool IsKnownRoot( | 53 virtual bool IsKnownRoot( |
64 const scoped_refptr<TrustAnchor>& trust_anchor) const = 0; | 54 const scoped_refptr<TrustAnchor>& trust_anchor) const = 0; |
65 | 55 |
66 // Adds a trust anchor to this particular instance of SystemTrustStore, and | 56 // Adds a trust anchor to this particular instance of SystemTrustStore, and |
67 // not globally for the system. | 57 // not globally for the system. |
(...skipping 11 matching lines...) Expand all Loading... |
79 // Creates an instance of SystemTrustStore that wraps the current platform's SSL | 69 // 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 | 70 // 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 | 71 // 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 | 72 // will only give access to the manually added trust anchors. This can be |
83 // inspected by testing whether UsesSystemTrustStore() returns false. | 73 // inspected by testing whether UsesSystemTrustStore() returns false. |
84 NET_EXPORT std::unique_ptr<SystemTrustStore> CreateSslSystemTrustStore(); | 74 NET_EXPORT std::unique_ptr<SystemTrustStore> CreateSslSystemTrustStore(); |
85 | 75 |
86 } // namespace net | 76 } // namespace net |
87 | 77 |
88 #endif // NET_CERT_INTERNAL_SYSTEM_TRUST_STORE_H_ | 78 #endif // NET_CERT_INTERNAL_SYSTEM_TRUST_STORE_H_ |
OLD | NEW |