x509_certificate_net_log_param.cc 744 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) 2012 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 "net/cert/x509_certificate_net_log_param.h"
  5. #include <memory>
  6. #include <string>
  7. #include <utility>
  8. #include <vector>
  9. #include "base/values.h"
  10. #include "net/cert/x509_certificate.h"
  11. #include "net/log/net_log_capture_mode.h"
  12. namespace net {
  13. base::Value NetLogX509CertificateList(const X509Certificate* certificate) {
  14. base::Value certs(base::Value::Type::LIST);
  15. std::vector<std::string> encoded_chain;
  16. certificate->GetPEMEncodedChain(&encoded_chain);
  17. for (auto& pem : encoded_chain)
  18. certs.Append(std::move(pem));
  19. return certs;
  20. }
  21. } // namespace net