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

Side by Side Diff: chromeos/network/onc/onc_certificate_importer_impl.h

Issue 148183013: Use per-user nssdb in onc certificate importer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_IMPL_H_ 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_IMPL_H_
6 #define CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_IMPL_H_ 6 #define CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 public: 39 public:
40 typedef std::map<std::string, scoped_refptr<net::X509Certificate> > 40 typedef std::map<std::string, scoped_refptr<net::X509Certificate> >
41 CertsByGUID; 41 CertsByGUID;
42 42
43 CertificateImporterImpl(); 43 CertificateImporterImpl();
44 44
45 // CertificateImporter overrides 45 // CertificateImporter overrides
46 virtual bool ImportCertificates( 46 virtual bool ImportCertificates(
47 const base::ListValue& certificates, 47 const base::ListValue& certificates,
48 ::onc::ONCSource source, 48 ::onc::ONCSource source,
49 net::NSSCertDatabase* target_nssdb,
49 net::CertificateList* onc_trusted_certificates) OVERRIDE; 50 net::CertificateList* onc_trusted_certificates) OVERRIDE;
50 51
51 // This implements ImportCertificates. Additionally, if 52 // This implements ImportCertificates. Additionally, if
52 // |imported_server_and_ca_certs| is not NULL, it will be filled with the 53 // |imported_server_and_ca_certs| is not NULL, it will be filled with the
53 // (GUID, Certificate) pairs of all succesfully imported Server and CA 54 // (GUID, Certificate) pairs of all succesfully imported Server and CA
54 // certificates. 55 // certificates.
55 bool ParseAndStoreCertificates(bool allow_trust_imports, 56 bool ParseAndStoreCertificates(bool allow_trust_imports,
56 const base::ListValue& onc_certificates, 57 const base::ListValue& onc_certificates,
57 net::CertificateList* onc_trusted_certificates, 58 net::CertificateList* onc_trusted_certificates,
59 net::NSSCertDatabase* target_nssdb,
58 CertsByGUID* imported_server_and_ca_certs); 60 CertsByGUID* imported_server_and_ca_certs);
59 61
62 private:
60 // Lists the certificates that have the string |label| as their certificate 63 // Lists the certificates that have the string |label| as their certificate
61 // nickname (exact match). 64 // nickname (exact match).
62 static void ListCertsWithNickname(const std::string& label, 65 static void ListCertsWithNickname(const std::string& label,
63 net::CertificateList* result); 66 net::CertificateList* result,
67 net::NSSCertDatabase* target_nssdb);
64 68
65 private:
66 // Deletes any certificate that has the string |label| as its nickname (exact 69 // Deletes any certificate that has the string |label| as its nickname (exact
67 // match). 70 // match).
68 static bool DeleteCertAndKeyByNickname(const std::string& label); 71 static bool DeleteCertAndKeyByNickname(const std::string& label,
72 net::NSSCertDatabase* target_nssdb);
69 73
70 // Parses and stores/removes |certificate| in/from the certificate 74 // Parses and stores/removes |certificate| in/from the certificate
71 // store. Returns true if the operation succeeded. 75 // store. Returns true if the operation succeeded.
72 bool ParseAndStoreCertificate( 76 bool ParseAndStoreCertificate(
73 bool allow_trust_imports, 77 bool allow_trust_imports,
74 const base::DictionaryValue& certificate, 78 const base::DictionaryValue& certificate,
75 net::CertificateList* onc_trusted_certificates, 79 net::CertificateList* onc_trusted_certificates,
80 net::NSSCertDatabase* target_nssdb,
76 CertsByGUID* imported_server_and_ca_certs); 81 CertsByGUID* imported_server_and_ca_certs);
77 82
78 // Imports the Server or CA certificate |certificate|. Web trust is only 83 // Imports the Server or CA certificate |certificate|. Web trust is only
79 // applied if the certificate requests the TrustBits attribute "Web" and if 84 // applied if the certificate requests the TrustBits attribute "Web" and if
80 // the |allow_trust_imports| permission is granted, otherwise the attribute is 85 // the |allow_trust_imports| permission is granted, otherwise the attribute is
81 // ignored. 86 // ignored.
82 bool ParseServerOrCaCertificate( 87 bool ParseServerOrCaCertificate(
83 bool allow_trust_imports, 88 bool allow_trust_imports,
84 const std::string& cert_type, 89 const std::string& cert_type,
85 const std::string& guid, 90 const std::string& guid,
86 const base::DictionaryValue& certificate, 91 const base::DictionaryValue& certificate,
87 net::CertificateList* onc_trusted_certificates, 92 net::CertificateList* onc_trusted_certificates,
93 net::NSSCertDatabase* target_nssdb,
88 CertsByGUID* imported_server_and_ca_certs); 94 CertsByGUID* imported_server_and_ca_certs);
89 95
90 bool ParseClientCertificate(const std::string& guid, 96 bool ParseClientCertificate(const std::string& guid,
91 const base::DictionaryValue& certificate); 97 const base::DictionaryValue& certificate,
98 net::NSSCertDatabase* target_nssdb);
92 99
93 DISALLOW_COPY_AND_ASSIGN(CertificateImporterImpl); 100 DISALLOW_COPY_AND_ASSIGN(CertificateImporterImpl);
94 }; 101 };
95 102
96 } // namespace onc 103 } // namespace onc
97 } // namespace chromeos 104 } // namespace chromeos
98 105
99 #endif // CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_IMPL_H_ 106 #endif // CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698