Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: chromeos/network/certificate_handler.cc

Issue 16946002: Resolve certificate references in ONC by PEM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a unit test for the resolve function. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/network/certificate_handler.h ('k') | chromeos/network/certificate_pattern.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/certificate_handler.h" 5 #include "chromeos/network/certificate_handler.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chromeos/network/onc/onc_certificate_importer.h" 8 #include "chromeos/network/onc/onc_certificate_importer.h"
9 #include "chromeos/network/onc/onc_utils.h" 9 #include "chromeos/network/onc/onc_utils.h"
10 10
11 namespace chromeos { 11 namespace chromeos {
12 12
13 CertificateHandler::CertificateHandler() { 13 CertificateHandler::CertificateHandler() {
14 } 14 }
15 15
16 CertificateHandler::~CertificateHandler() { 16 CertificateHandler::~CertificateHandler() {
17 } 17 }
18 18
19 bool CertificateHandler::ImportCertificates( 19 bool CertificateHandler::ImportCertificates(
20 const base::ListValue& certificates, 20 const base::ListValue& certificates,
21 onc::ONCSource source, 21 onc::ONCSource source,
22 net::CertificateList* onc_trusted_certificates) { 22 net::CertificateList* onc_trusted_certificates,
23 CertsByGUID* imported_server_and_ca_certs) {
23 VLOG(2) << "ONC file has " << certificates.GetSize() << " certificates"; 24 VLOG(2) << "ONC file has " << certificates.GetSize() << " certificates";
24 25
25 // Web trust is only granted to certificates imported by the user. 26 // Web trust is only granted to certificates imported by the user.
26 bool allow_trust_imports = source == onc::ONC_SOURCE_USER_IMPORT; 27 bool allow_trust_imports = source == onc::ONC_SOURCE_USER_IMPORT;
27 onc::CertificateImporter cert_importer(allow_trust_imports); 28 onc::CertificateImporter cert_importer(allow_trust_imports);
28 if (cert_importer.ParseAndStoreCertificates( 29 if (cert_importer.ParseAndStoreCertificates(
29 certificates, onc_trusted_certificates) != 30 certificates,
31 onc_trusted_certificates,
32 imported_server_and_ca_certs) !=
30 onc::CertificateImporter::IMPORT_OK) { 33 onc::CertificateImporter::IMPORT_OK) {
31 LOG(ERROR) << "Cannot parse some of the certificates in the ONC from " 34 LOG(ERROR) << "Cannot parse some of the certificates in the ONC from "
32 << onc::GetSourceAsString(source); 35 << onc::GetSourceAsString(source);
33 return false; 36 return false;
34 } 37 }
35 return true; 38 return true;
36 } 39 }
37 40
38 } // namespace chromeos 41 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/certificate_handler.h ('k') | chromeos/network/certificate_pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698