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 #ifndef CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_H_ | 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_H_ |
6 #define CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_H_ | 6 #define CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // Parses and stores/removes |certificate| in/from the certificate | 56 // Parses and stores/removes |certificate| in/from the certificate |
57 // store. Returns true if the operation succeeded. | 57 // store. Returns true if the operation succeeded. |
58 bool ParseAndStoreCertificate(const base::DictionaryValue& certificate); | 58 bool ParseAndStoreCertificate(const base::DictionaryValue& certificate); |
59 | 59 |
60 // Lists the certificates that have the string |label| as their certificate | 60 // Lists the certificates that have the string |label| as their certificate |
61 // nickname (exact match). | 61 // nickname (exact match). |
62 static void ListCertsWithNickname(const std::string& label, | 62 static void ListCertsWithNickname(const std::string& label, |
63 net::CertificateList* result); | 63 net::CertificateList* result); |
64 | 64 |
| 65 // Find the PKCS#11 ID of the certificate with the given GUID. Returns an |
| 66 // empty string on failure. |
| 67 static std::string GetPkcs11IdFromCertGuid(const std::string& guid); |
| 68 |
65 protected: | 69 protected: |
66 // Deletes any certificate that has the string |label| as its nickname (exact | 70 // Deletes any certificate that has the string |label| as its nickname (exact |
67 // match). | 71 // match). |
68 static bool DeleteCertAndKeyByNickname(const std::string& label); | 72 static bool DeleteCertAndKeyByNickname(const std::string& label); |
69 | 73 |
70 private: | 74 private: |
71 bool ParseServerOrCaCertificate(const std::string& cert_type, | 75 bool ParseServerOrCaCertificate(const std::string& cert_type, |
72 const std::string& guid, | 76 const std::string& guid, |
73 const base::DictionaryValue& certificate); | 77 const base::DictionaryValue& certificate); |
74 | 78 |
75 bool ParseClientCertificate(const std::string& guid, | 79 bool ParseClientCertificate(const std::string& guid, |
76 const base::DictionaryValue& certificate); | 80 const base::DictionaryValue& certificate); |
77 | 81 |
78 // Where the ONC blob comes from. | 82 // Where the ONC blob comes from. |
79 ONCSource onc_source_; | 83 ONCSource onc_source_; |
80 | 84 |
81 // Whether certificates with Web trust should be stored when pushed from a | 85 // Whether certificates with Web trust should be stored when pushed from a |
82 // policy source. | 86 // policy source. |
83 bool allow_web_trust_from_policy_; | 87 bool allow_web_trust_from_policy_; |
84 | 88 |
85 DISALLOW_COPY_AND_ASSIGN(CertificateImporter); | 89 DISALLOW_COPY_AND_ASSIGN(CertificateImporter); |
86 }; | 90 }; |
87 | 91 |
88 } // chromeos | 92 } // chromeos |
89 } // onc | 93 } // onc |
90 | 94 |
91 #endif // CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_H_ | 95 #endif // CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_H_ |
OLD | NEW |