Pavol Marko | f38cb21 | 2018-11-19 20:47:10 | [diff] [blame] | 1 | // Copyright 2017 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 | |
| 5 | #include "services/network/nss_temp_certs_cache_chromeos.h" |
| 6 | |
| 7 | #include "net/cert/x509_util_nss.h" |
| 8 | |
| 9 | namespace network { |
| 10 | |
| 11 | NSSTempCertsCacheChromeOS::NSSTempCertsCacheChromeOS( |
| 12 | const net::CertificateList& certificates) { |
| 13 | for (const auto& certificate : certificates) { |
| 14 | net::ScopedCERTCertificate x509_cert = |
| 15 | net::x509_util::CreateCERTCertificateFromX509Certificate( |
| 16 | certificate.get()); |
| 17 | if (!x509_cert) { |
| 18 | LOG(ERROR) << "Unable to create CERTCertificate"; |
| 19 | continue; |
| 20 | } |
| 21 | |
| 22 | temp_certs_.push_back(std::move(x509_cert)); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | NSSTempCertsCacheChromeOS::~NSSTempCertsCacheChromeOS() {} |
| 27 | |
| 28 | } // namespace network |