summaryrefslogtreecommitdiff
path: root/chromium/services/network/nss_temp_certs_cache_chromeos.cc
blob: 2b5b6ecc87ea2eb059037c653b92b5fa039e971b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "services/network/nss_temp_certs_cache_chromeos.h"

#include "base/logging.h"
#include "net/cert/x509_util_nss.h"

namespace network {

NSSTempCertsCacheChromeOS::NSSTempCertsCacheChromeOS(
    const net::CertificateList& certificates) {
  for (const auto& certificate : certificates) {
    net::ScopedCERTCertificate x509_cert =
        net::x509_util::CreateCERTCertificateFromX509Certificate(
            certificate.get());
    if (!x509_cert) {
      LOG(ERROR) << "Unable to create CERTCertificate";
      continue;
    }

    temp_certs_.push_back(std::move(x509_cert));
  }
}

NSSTempCertsCacheChromeOS::~NSSTempCertsCacheChromeOS() {}

}  // namespace network