ct_known_logs.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 COMPONENTS_CERTIFICATE_TRANSPARENCY_CT_KNOWN_LOGS_H_
  5. #define COMPONENTS_CERTIFICATE_TRANSPARENCY_CT_KNOWN_LOGS_H_
  6. #include <vector>
  7. #include "base/component_export.h"
  8. #include "base/memory/ref_counted.h"
  9. #include "base/strings/string_piece.h"
  10. #include "base/time/time.h"
  11. #include "build/build_config.h"
  12. namespace certificate_transparency {
  13. struct PreviousOperatorEntry {
  14. // Name of the previous operator.
  15. const char* const name;
  16. // Time when the operator stopped operating this log, expressed as a TimeDelta
  17. // from the Unix Epoch.
  18. const base::Time end_time;
  19. };
  20. struct CTLogInfo {
  21. // The DER-encoded SubjectPublicKeyInfo for the log. Note that this is not
  22. // the same as a "log ID": a log ID is the SHA-256 hash of this value.
  23. const char* const log_key;
  24. // The length, in bytes, of |log_key|.
  25. const size_t log_key_length;
  26. // The user-friendly log name.
  27. // Note: This will not be translated.
  28. const char* const log_name;
  29. // The current operator of the log.
  30. const char* const current_operator;
  31. // Previous operators (if any) of the log, ordered in chronological order.
  32. const PreviousOperatorEntry* previous_operators;
  33. const size_t previous_operators_length;
  34. };
  35. // Returns the time at which the log list was last updated.
  36. COMPONENT_EXPORT(CERTIFICATE_TRANSPARENCY) base::Time GetLogListTimestamp();
  37. // Returns information about all known logs, which includes those that are
  38. // presently qualified for inclusion and logs which were previously qualified,
  39. // but have since been disqualified. To determine the status of a given log
  40. // (via its log ID), use |GetDisqualifiedLogs()|.
  41. COMPONENT_EXPORT(CERTIFICATE_TRANSPARENCY)
  42. std::vector<CTLogInfo> GetKnownLogs();
  43. // Returns the log IDs of all logs that are operated by Google, sorted. The log
  44. // ID is the SHA-256 hash of the log's |log_key|.
  45. COMPONENT_EXPORT(CERTIFICATE_TRANSPARENCY)
  46. std::vector<std::string> GetLogsOperatedByGoogle();
  47. // Returns pairs of (log ID, disqualification date) for all disqualified logs,
  48. // where the log ID is the SHA-256 hash of the log's |log_key|). The list is
  49. // sorted by log ID. The disqualification date is expressed as seconds since
  50. // the Unix epoch.
  51. //
  52. // Any SCTs that are embedded in certificates issued after the disqualification
  53. // date should not be trusted, nor contribute to any uniqueness or freshness
  54. // requirements.
  55. COMPONENT_EXPORT(CERTIFICATE_TRANSPARENCY)
  56. std::vector<std::pair<std::string, base::Time>> GetDisqualifiedLogs();
  57. } // namespace certificate_transparency
  58. #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_CT_KNOWN_LOGS_H_