OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/network/onc/onc_utils.h" | 5 #include "chromeos/network/onc/onc_utils.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 return decoded; | 376 return decoded; |
377 } | 377 } |
378 | 378 |
379 } // namespace | 379 } // namespace |
380 | 380 |
381 scoped_refptr<net::X509Certificate> DecodePEMCertificate( | 381 scoped_refptr<net::X509Certificate> DecodePEMCertificate( |
382 const std::string& pem_encoded) { | 382 const std::string& pem_encoded) { |
383 std::string decoded = DecodePEM(pem_encoded); | 383 std::string decoded = DecodePEM(pem_encoded); |
384 scoped_refptr<net::X509Certificate> cert = | 384 scoped_refptr<net::X509Certificate> cert = |
385 net::X509Certificate::CreateFromBytes(decoded.data(), decoded.size()); | 385 net::X509Certificate::CreateFromBytes(decoded.data(), decoded.size()); |
386 LOG_IF(ERROR, !cert) << "Couldn't create certificate from X509 data: " | 386 LOG_IF(ERROR, !cert.get()) << "Couldn't create certificate from X509 data: " |
387 << decoded; | 387 << decoded; |
388 return cert; | 388 return cert; |
389 } | 389 } |
390 | 390 |
391 namespace { | 391 namespace { |
392 | 392 |
393 bool GUIDRefToPEMEncoding(const CertsByGUIDMap& certs_by_guid, | 393 bool GUIDRefToPEMEncoding(const CertsByGUIDMap& certs_by_guid, |
394 const std::string& guid_ref, | 394 const std::string& guid_ref, |
395 std::string* pem_encoded) { | 395 std::string* pem_encoded) { |
396 CertsByGUIDMap::const_iterator it = certs_by_guid.find(guid_ref); | 396 CertsByGUIDMap::const_iterator it = certs_by_guid.find(guid_ref); |
397 if (it == certs_by_guid.end()) { | 397 if (it == certs_by_guid.end()) { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 546 |
547 bool ResolveServerCertRefsInNetwork(const CertsByGUIDMap& certs_by_guid, | 547 bool ResolveServerCertRefsInNetwork(const CertsByGUIDMap& certs_by_guid, |
548 base::DictionaryValue* network_config) { | 548 base::DictionaryValue* network_config) { |
549 return ResolveServerCertRefsInObject(certs_by_guid, | 549 return ResolveServerCertRefsInObject(certs_by_guid, |
550 kNetworkConfigurationSignature, | 550 kNetworkConfigurationSignature, |
551 network_config); | 551 network_config); |
552 } | 552 } |
553 | 553 |
554 } // namespace onc | 554 } // namespace onc |
555 } // namespace chromeos | 555 } // namespace chromeos |
OLD | NEW |