ct_verifier.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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
  3. // found in the LICENSE file.
  4. #ifndef NET_CERT_CT_VERIFIER_H_
  5. #define NET_CERT_CT_VERIFIER_H_
  6. #include "base/strings/string_piece.h"
  7. #include "net/base/net_export.h"
  8. #include "net/cert/signed_certificate_timestamp_and_status.h"
  9. namespace net {
  10. class NetLogWithSource;
  11. class X509Certificate;
  12. // Interface for verifying Signed Certificate Timestamps over a certificate.
  13. class NET_EXPORT CTVerifier {
  14. public:
  15. virtual ~CTVerifier() = default;
  16. // Verifies SCTs embedded in the certificate itself, SCTs embedded in a
  17. // stapled OCSP response, and SCTs obtained via the
  18. // signed_certificate_timestamp TLS extension on the given |cert|.
  19. // A certificate is permitted but not required to use multiple sources for
  20. // SCTs. It is expected that most certificates will use only one source
  21. // (embedding, TLS extension or OCSP stapling). If no stapled OCSP response
  22. // is available, |stapled_ocsp_response| should be an empty string. If no SCT
  23. // TLS extension was negotiated, |sct_list_from_tls_extension| should be an
  24. // empty string. |output_scts| will be cleared and filled with the SCTs
  25. // present, if any, along with their verification results.
  26. // The |hostname| (or IP address literal) of the server that presented |cert|
  27. // must be provided so that inclusion checks for |cert| are able to avoid
  28. // leaking information about which servers have been visited.
  29. virtual void Verify(base::StringPiece hostname,
  30. X509Certificate* cert,
  31. base::StringPiece stapled_ocsp_response,
  32. base::StringPiece sct_list_from_tls_extension,
  33. SignedCertificateTimestampAndStatusList* output_scts,
  34. const NetLogWithSource& net_log) = 0;
  35. };
  36. } // namespace net
  37. #endif // NET_CERT_CT_VERIFIER_H_