ct_known_logs.cc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #include "components/certificate_transparency/ct_known_logs.h"
  5. #include <stddef.h>
  6. #include <string.h>
  7. #include <algorithm>
  8. #include <iterator>
  9. #include "base/time/time.h"
  10. #include "crypto/sha2.h"
  11. namespace certificate_transparency {
  12. namespace {
  13. #include "components/certificate_transparency/data/log_list-inc.cc"
  14. } // namespace
  15. base::Time GetLogListTimestamp() {
  16. return kLogListTimestamp;
  17. }
  18. std::vector<CTLogInfo> GetKnownLogs() {
  19. // Add all qualified logs.
  20. std::vector<CTLogInfo> logs(std::begin(kCTLogList), std::end(kCTLogList));
  21. // Add all disqualified logs. Callers are expected to filter verified SCTs
  22. // via IsLogDisqualified().
  23. for (const auto& disqualified_log : kDisqualifiedCTLogList) {
  24. logs.push_back(disqualified_log.log_info);
  25. }
  26. return logs;
  27. }
  28. std::vector<std::string> GetLogsOperatedByGoogle() {
  29. std::vector<std::string> result;
  30. for (const auto& log_id : kGoogleLogIDs) {
  31. result.push_back(std::string(log_id, crypto::kSHA256Length));
  32. }
  33. return result;
  34. }
  35. std::vector<std::pair<std::string, base::Time>> GetDisqualifiedLogs() {
  36. std::vector<std::pair<std::string, base::Time>> result;
  37. for (const auto& log : kDisqualifiedCTLogList) {
  38. result.push_back(
  39. std::make_pair(std::string(log.log_id, crypto::kSHA256Length),
  40. log.disqualification_date));
  41. }
  42. return result;
  43. }
  44. } // namespace certificate_transparency