OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_TRUST_STORE_H_ | 5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_H_ |
6 #define NET_CERT_INTERNAL_TRUST_STORE_H_ | 6 #define NET_CERT_INTERNAL_TRUST_STORE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | |
11 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
12 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
13 #include "net/cert/internal/parsed_certificate.h" | 12 #include "net/cert/internal/parsed_certificate.h" |
14 | 13 |
15 namespace net { | 14 namespace net { |
16 | 15 |
17 namespace der { | 16 namespace der { |
18 class Input; | 17 class Input; |
19 } | 18 } |
20 | 19 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 107 |
109 scoped_refptr<ParsedCertificate> cert_; | 108 scoped_refptr<ParsedCertificate> cert_; |
110 bool enforces_constraints_ = false; | 109 bool enforces_constraints_ = false; |
111 }; | 110 }; |
112 | 111 |
113 using TrustAnchors = std::vector<scoped_refptr<TrustAnchor>>; | 112 using TrustAnchors = std::vector<scoped_refptr<TrustAnchor>>; |
114 | 113 |
115 // Interface for finding trust anchors. | 114 // Interface for finding trust anchors. |
116 class NET_EXPORT TrustStore { | 115 class NET_EXPORT TrustStore { |
117 public: | 116 public: |
118 class NET_EXPORT Request { | |
119 public: | |
120 Request(); | |
121 // Destruction of the Request cancels it. | |
122 virtual ~Request(); | |
123 }; | |
124 | |
125 TrustStore(); | 117 TrustStore(); |
126 virtual ~TrustStore(); | 118 virtual ~TrustStore(); |
127 | 119 |
128 using TrustAnchorsCallback = base::Callback<void(TrustAnchors)>; | 120 // Appends the trust anchors that match |cert|'s issuer name to |*matches|. |
129 | 121 // |cert| and |matches| must not be null. |
130 // Returns the trust anchors that match |cert|'s issuer name in | |
131 // |*synchronous_matches| and/or through |callback|. |cert| and | |
132 // |synchronous_matches| must not be null. | |
133 // | |
134 // If results are available synchronously, they will be appended to | |
135 // |*synchronous_matches|. |*synchronous_matches| will not be modified | |
136 // asynchronously. | |
137 // | |
138 // If |callback| is not null and results may be available asynchronously, | |
139 // |*out_req| will be filled with a Request, and |callback| will be called | |
140 // when results are available. The Request may be destroyed to cancel | |
141 // the callback if it has not occurred yet. | |
142 virtual void FindTrustAnchorsForCert( | 122 virtual void FindTrustAnchorsForCert( |
143 const scoped_refptr<ParsedCertificate>& cert, | 123 const scoped_refptr<ParsedCertificate>& cert, |
144 const TrustAnchorsCallback& callback, | 124 TrustAnchors* matches) const = 0; |
145 TrustAnchors* synchronous_matches, | |
146 std::unique_ptr<Request>* out_req) const = 0; | |
147 | 125 |
148 private: | 126 private: |
149 DISALLOW_COPY_AND_ASSIGN(TrustStore); | 127 DISALLOW_COPY_AND_ASSIGN(TrustStore); |
150 }; | 128 }; |
151 | 129 |
152 } // namespace net | 130 } // namespace net |
153 | 131 |
154 #endif // NET_CERT_INTERNAL_TRUST_STORE_H_ | 132 #endif // NET_CERT_INTERNAL_TRUST_STORE_H_ |
OLD | NEW |