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

Side by Side Diff: net/cert/ct_verifier.h

Issue 1100003006: Certificate Transparency: Fetching of Signed Tree Heads (DRAFT) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revised design, addressed some comments Created 5 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CT_VERIFIER_H_ 5 #ifndef NET_CERT_CT_VERIFIER_H_
6 #define NET_CERT_CT_VERIFIER_H_ 6 #define NET_CERT_CT_VERIFIER_H_
7 7
8 #include <string>
9
10 #include "base/macros.h"
8 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
9 12
10 namespace net { 13 namespace net {
11 14
12 namespace ct { 15 namespace ct {
13 struct CTVerifyResult; 16 struct CTVerifyResult;
17 struct SignedCertificateTimestamp;
14 } // namespace ct 18 } // namespace ct
15 19
16 class BoundNetLog; 20 class BoundNetLog;
21 class CTLogVerifier;
17 class X509Certificate; 22 class X509Certificate;
18 23
19 // Interface for verifying Signed Certificate Timestamps over a certificate. 24 // Interface for verifying Signed Certificate Timestamps over a certificate.
20 class NET_EXPORT CTVerifier { 25 class NET_EXPORT CTVerifier {
21 public: 26 public:
22 virtual ~CTVerifier() {} 27 class NET_EXPORT Observer {
28 public:
29 virtual ~Observer() {}
30
31 virtual void OnSCTVerified(const ct::SignedCertificateTimestamp* sct,
Ryan Sleevi 2015/06/29 11:58:13 Document when/how this is called
32 CTLogVerifier* verifier) {}
Ryan Sleevi 2015/06/29 11:58:13 make this pure virtual
33
34 protected:
35 Observer() {}
36
37 private:
38 DISALLOW_COPY_AND_ASSIGN(Observer);
Ryan Sleevi 2015/06/29 11:58:13 delete; unneeded for pure interfaces
39 };
40
41 CTVerifier();
42 virtual ~CTVerifier();
23 43
24 // Verifies SCTs embedded in the certificate itself, SCTs embedded in a 44 // Verifies SCTs embedded in the certificate itself, SCTs embedded in a
25 // stapled OCSP response, and SCTs obtained via the 45 // stapled OCSP response, and SCTs obtained via the
26 // signed_certificate_timestamp TLS extension on the given |cert|. 46 // signed_certificate_timestamp TLS extension on the given |cert|.
27 // A certificate is permitted but not required to use multiple sources for 47 // A certificate is permitted but not required to use multiple sources for
28 // SCTs. It is expected that most certificates will use only one source 48 // SCTs. It is expected that most certificates will use only one source
29 // (embedding, TLS extension or OCSP stapling). If no stapled OCSP response 49 // (embedding, TLS extension or OCSP stapling). If no stapled OCSP response
30 // is available, |stapled_ocsp_response| should be an empty string. If no SCT 50 // is available, |stapled_ocsp_response| should be an empty string. If no SCT
31 // TLS extension was negotiated, |sct_list_from_tls_extension| should be an 51 // TLS extension was negotiated, |sct_list_from_tls_extension| should be an
32 // empty string. |result| will be filled with the SCTs present, divided into 52 // empty string. |result| will be filled with the SCTs present, divided into
33 // categories based on the verification result. 53 // categories based on the verification result.
34 virtual int Verify(X509Certificate* cert, 54 virtual int Verify(X509Certificate* cert,
35 const std::string& stapled_ocsp_response, 55 const std::string& stapled_ocsp_response,
36 const std::string& sct_list_from_tls_extension, 56 const std::string& sct_list_from_tls_extension,
37 ct::CTVerifyResult* result, 57 ct::CTVerifyResult* result,
38 const BoundNetLog& net_log) = 0; 58 const BoundNetLog& net_log) = 0;
59
60 virtual void StopNotifications() = 0;
61
62 // Registers |observer| to receive notifications of validated SCTs. The
63 // thread on which this is called is the thread on which |observer| will be
64 // called back with notifications. Does not take ownership of the observer
65 // as the observer may be performing URLRequests which have to be cancelled
66 // before this object is destroyed.
67 virtual void SetObserver(Observer* observer) = 0;
68
69 private:
70 DISALLOW_COPY_AND_ASSIGN(CTVerifier);
Ryan Sleevi 2015/06/29 11:58:13 ditto about unneeded for pure interfaces
39 }; 71 };
40 72
41 } // namespace net 73 } // namespace net
42 74
43 #endif // NET_CERT_CT_VERIFIER_H_ 75 #endif // NET_CERT_CT_VERIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698