xref: /aosp_15_r20/external/cronet/net/cert/ct_verifier.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2013 The Chromium Authors
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_CT_VERIFIER_H_
6 #define NET_CERT_CT_VERIFIER_H_
7 
8 #include <string_view>
9 
10 #include "net/base/net_export.h"
11 #include "net/cert/signed_certificate_timestamp_and_status.h"
12 
13 namespace net {
14 
15 class NetLogWithSource;
16 class X509Certificate;
17 
18 // Interface for verifying Signed Certificate Timestamps over a certificate.
19 class NET_EXPORT CTVerifier {
20  public:
21   virtual ~CTVerifier() = default;
22 
23   // Verifies SCTs embedded in the certificate itself, SCTs embedded in a
24   // stapled OCSP response, and SCTs obtained via the
25   // signed_certificate_timestamp TLS extension on the given |cert|.
26   // A certificate is permitted but not required to use multiple sources for
27   // SCTs. It is expected that most certificates will use only one source
28   // (embedding, TLS extension or OCSP stapling). If no stapled OCSP response
29   // is available, |stapled_ocsp_response| should be an empty string. If no SCT
30   // TLS extension was negotiated, |sct_list_from_tls_extension| should be an
31   // empty string. |output_scts| will be cleared and filled with the SCTs
32   // present, if any, along with their verification results.
33   virtual void Verify(X509Certificate* cert,
34                       std::string_view stapled_ocsp_response,
35                       std::string_view sct_list_from_tls_extension,
36                       SignedCertificateTimestampAndStatusList* output_scts,
37                       const NetLogWithSource& net_log) const = 0;
38 };
39 
40 }  // namespace net
41 
42 #endif  // NET_CERT_CT_VERIFIER_H_
43