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_CERT_ISSUER_SOURCE_H_ | 5 #ifndef NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ |
6 #define NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ | 6 #define NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
13 #include "net/cert/internal/completion_status.h" | 13 #include "net/cert/internal/completion_status.h" |
| 14 #include "net/cert/internal/parsed_certificate.h" |
14 | 15 |
15 namespace net { | 16 namespace net { |
16 | 17 |
17 class ParsedCertificate; | |
18 | |
19 // Interface for looking up issuers of a certificate during path building. | 18 // Interface for looking up issuers of a certificate during path building. |
20 // Provides a synchronous and asynchronous method for retrieving issuers, so the | 19 // Provides a synchronous and asynchronous method for retrieving issuers, so the |
21 // path builder can try to complete synchronously first. The caller is expected | 20 // path builder can try to complete synchronously first. The caller is expected |
22 // to call SyncGetIssuersOf first, see if it can make progress with those | 21 // to call SyncGetIssuersOf first, see if it can make progress with those |
23 // results, and if not, then fall back to calling AsyncGetIssuersOf. | 22 // results, and if not, then fall back to calling AsyncGetIssuersOf. |
24 // An implementations may choose to return results from either one of the Get | 23 // An implementations may choose to return results from either one of the Get |
25 // methods, or from both. | 24 // methods, or from both. |
26 class NET_EXPORT CertIssuerSource { | 25 class NET_EXPORT CertIssuerSource { |
27 public: | 26 public: |
28 class NET_EXPORT Request { | 27 class NET_EXPORT Request { |
(...skipping 22 matching lines...) Expand all Loading... |
51 }; | 50 }; |
52 | 51 |
53 using IssuerCallback = base::Callback<void(Request*)>; | 52 using IssuerCallback = base::Callback<void(Request*)>; |
54 | 53 |
55 virtual ~CertIssuerSource() = default; | 54 virtual ~CertIssuerSource() = default; |
56 | 55 |
57 // Finds certificates whose Subject matches |cert|'s Issuer. | 56 // Finds certificates whose Subject matches |cert|'s Issuer. |
58 // Matches are appended to |issuers|. Any existing contents of |issuers| will | 57 // Matches are appended to |issuers|. Any existing contents of |issuers| will |
59 // not be modified. If the implementation does not support synchronous | 58 // not be modified. If the implementation does not support synchronous |
60 // lookups, or if there are no matches, |issuers| is not modified. | 59 // lookups, or if there are no matches, |issuers| is not modified. |
61 virtual void SyncGetIssuersOf( | 60 virtual void SyncGetIssuersOf(const ParsedCertificate* cert, |
62 const ParsedCertificate* cert, | 61 ParsedCertificateList* issuers) = 0; |
63 std::vector<scoped_refptr<ParsedCertificate>>* issuers) = 0; | |
64 | 62 |
65 // Finds certificates whose Subject matches |cert|'s Issuer. | 63 // Finds certificates whose Subject matches |cert|'s Issuer. |
66 // If an async callback will be made |*out_req| is filled with a Request | 64 // If an async callback will be made |*out_req| is filled with a Request |
67 // object which may be destroyed to cancel the callback. If the implementation | 65 // object which may be destroyed to cancel the callback. If the implementation |
68 // does not support asynchronous lookups or can determine synchronously that | 66 // does not support asynchronous lookups or can determine synchronously that |
69 // it would return no results, |*out_req| will be set to nullptr. | 67 // it would return no results, |*out_req| will be set to nullptr. |
70 // | 68 // |
71 // When matches are available or the request is complete, |issuers_callback| | 69 // When matches are available or the request is complete, |issuers_callback| |
72 // will be called with a pointer to the same Request. The Request::GetNext | 70 // will be called with a pointer to the same Request. The Request::GetNext |
73 // method may then be used to iterate through the retrieved issuers. Note that | 71 // method may then be used to iterate through the retrieved issuers. Note that |
74 // |issuers_callback| may be called multiple times. See the documentation for | 72 // |issuers_callback| may be called multiple times. See the documentation for |
75 // Request::GetNext for more details. | 73 // Request::GetNext for more details. |
76 virtual void AsyncGetIssuersOf(const ParsedCertificate* cert, | 74 virtual void AsyncGetIssuersOf(const ParsedCertificate* cert, |
77 const IssuerCallback& issuers_callback, | 75 const IssuerCallback& issuers_callback, |
78 std::unique_ptr<Request>* out_req) = 0; | 76 std::unique_ptr<Request>* out_req) = 0; |
79 }; | 77 }; |
80 | 78 |
81 } // namespace net | 79 } // namespace net |
82 | 80 |
83 #endif // NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ | 81 #endif // NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ |
OLD | NEW |