ct_objects_extractor.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_OBJECTS_EXTRACTOR_H_
  5. #define NET_CERT_CT_OBJECTS_EXTRACTOR_H_
  6. #include <string>
  7. #include "base/strings/string_piece.h"
  8. #include "net/base/net_export.h"
  9. #include "net/cert/x509_certificate.h"
  10. namespace net::ct {
  11. struct SignedEntryData;
  12. // Extracts a SignedCertificateTimestampList that has been embedded within a
  13. // leaf cert as an X.509v3 extension with the OID 1.3.6.1.4.1.11129.2.4.2.
  14. // If the extension is present, returns true, updating |*sct_list| to contain
  15. // the encoded list, minus the DER encoding necessary for the extension.
  16. // |*sct_list| can then be further decoded with ct::DecodeSCTList
  17. NET_EXPORT_PRIVATE bool ExtractEmbeddedSCTList(const CRYPTO_BUFFER* cert,
  18. std::string* sct_list);
  19. // Obtains a PrecertChain log entry for |leaf|, an X.509v3 certificate that
  20. // contains an X.509v3 extension with the OID 1.3.6.1.4.1.11129.2.4.2. On
  21. // success, fills |*result| with the data for a PrecertChain log entry and
  22. // returns true.
  23. // The filled |*result| should be verified using ct::CTLogVerifier::Verify
  24. // Note: If |leaf| does not contain the required extension, it is treated as
  25. // a failure.
  26. NET_EXPORT_PRIVATE bool GetPrecertSignedEntry(const CRYPTO_BUFFER* leaf,
  27. const CRYPTO_BUFFER* issuer,
  28. SignedEntryData* result);
  29. // Obtains an X509Chain log entry for |leaf|, an X.509v3 certificate that
  30. // is not expected to contain an X.509v3 extension with the OID
  31. // 1.3.6.1.4.1.11129.2.4.2 (meaning a certificate without an embedded SCT).
  32. // On success, fills |result| with the data for an X509Chain log entry and
  33. // returns true.
  34. // The filled |*result| should be verified using ct::CTLogVerifier::Verify
  35. NET_EXPORT_PRIVATE bool GetX509SignedEntry(const CRYPTO_BUFFER* leaf,
  36. SignedEntryData* result);
  37. // Extracts a SignedCertificateTimestampList that has been embedded within
  38. // an OCSP response as an extension with the OID 1.3.6.1.4.1.11129.2.4.5.
  39. // If the extension is present, and the response matches the issuer and
  40. // serial number, returns true, updating |*sct_list| to contain
  41. // the encoded list, minus the DER encoding necessary for the extension.
  42. // |*sct_list| can then be further decoded with ct::DecodeSCTList.
  43. NET_EXPORT_PRIVATE bool ExtractSCTListFromOCSPResponse(
  44. const CRYPTO_BUFFER* issuer,
  45. const std::string& cert_serial_number,
  46. base::StringPiece ocsp_response,
  47. std::string* sct_list);
  48. } // namespace net::ct
  49. #endif // NET_CERT_CT_OBJECTS_EXTRACTOR_H_