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

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

Issue 2030693002: Add CertIssuerSource interface and CertIssuerSourceStatic implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert-parsing-base
Patch Set: . Created 4 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_CERT_INTERNAL_CERT_SOURCE_H_
6 #define NET_CERT_INTERNAL_CERT_SOURCE_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "net/base/net_export.h"
13 #include "net/cert/internal/completion_status.h"
14
15 namespace net {
16
17 class ParsedCertificate;
18
19 // Interface for looking up issuers of a certificate during path building.
eroman 2016/06/01 20:52:10 Can you clarify in the comments and interface, how
mattm 2016/06/01 22:20:41 Done.
20 // Provides a synchronous and asynchronous method for retrieving issuers, so the
21 // path builder can try to complete synchronously first.
22 // Implementations may choose to return results from either one of the Get
23 // methods, or from both.
24 class NET_EXPORT CertSource {
eroman 2016/06/01 20:52:10 How about working "issuer" into the name somewhere
mattm 2016/06/01 22:20:41 Done.
25 public:
26 class NET_EXPORT Request {
27 public:
28 Request() {}
29 // Destruction of the Request cancels it.
30 virtual ~Request() {}
31
32 // Retrieves the next issuer.
33 //
34 // If one is available it will be stored in |out_cert| and SYNC will be
35 // returned. GetNext should be called again to retrieve any remaining
36 // issuers.
37 //
38 // If no issuers are available, |out_cert| will be cleared and the return
39 // value will indicate if the Request is exhausted. If the return value is
40 // SYNC, the Request is complete and the |issuers_callback| will not be
eroman 2016/06/01 20:52:10 not clear that this is referring to the outer one
mattm 2016/06/01 22:20:41 Done.
41 // called again. If the return value is ASYNC, the |issuers_callback| will
42 // be called again (unless the Request is destroyed first).
43 virtual CompletionStatus GetNext(
44 scoped_refptr<ParsedCertificate>* out_cert) = 0;
45
46 private:
47 DISALLOW_COPY_AND_ASSIGN(Request);
48 };
49
50 using IssuerCallback = base::Callback<void(Request*)>;
51
52 virtual ~CertSource() {}
eroman 2016/06/01 20:52:10 = default; ?
mattm 2016/06/01 22:20:41 Done.
53
54 // Finds certificates whose Subject matches |cert|'s Issuer.
55 // Matches are appended to |issuers|. Any existing contents of |issuers| will
56 // not be modified.
57 virtual void SyncGetIssuersOf(
58 const ParsedCertificate* cert,
59 std::vector<scoped_refptr<ParsedCertificate>>* issuers) = 0;
60
61 // Finds certificates whose Subject matches |cert|'s Issuer.
62 // If an async callback will be made |*out_req| is filled with a Request
63 // object which may be destroyed to cancel the callback.
64 //
65 // When matches are available or the request is complete, |issuers_callback|
66 // will be called with a pointer to the same Request. The Request::GetNext
67 // method may then be used to iterate through the retrieved issuers. Note that
68 // |issuers_callback| may be called multiple times. See the documentation for
69 // Request::GetNext for more details.
70 virtual void AsyncGetIssuersOf(const ParsedCertificate* cert,
71 const IssuerCallback& issuers_callback,
72 std::unique_ptr<Request>* out_req) = 0;
73 };
74
75 } // namespace net
76
77 #endif // NET_CERT_INTERNAL_CERT_SOURCE_H_
OLDNEW
« no previous file with comments | « no previous file | net/cert/internal/cert_source_static.h » ('j') | net/cert/internal/cert_source_static_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698