OLD | NEW |
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 #ifndef CHROMEOS_CERT_LOADER_H_ | 5 #ifndef CHROMEOS_CERT_LOADER_H_ |
6 #define CHROMEOS_CERT_LOADER_H_ | 6 #define CHROMEOS_CERT_LOADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 // Destroys the global instance. | 51 // Destroys the global instance. |
52 static void Shutdown(); | 52 static void Shutdown(); |
53 | 53 |
54 // Gets the global instance. Initialize() must be called first. | 54 // Gets the global instance. Initialize() must be called first. |
55 static CertLoader* Get(); | 55 static CertLoader* Get(); |
56 | 56 |
57 // Returns true if the global instance has been initialized. | 57 // Returns true if the global instance has been initialized. |
58 static bool IsInitialized(); | 58 static bool IsInitialized(); |
59 | 59 |
| 60 // Returns the PKCS#11 attribute CKA_ID for a certificate as an upper-case |
| 61 // hex string, or the empty string if none is found. Note that the returned ID |
| 62 // should be used only to identify the cert in its slot. |
| 63 // This should be used only for user certificates, assuming that only one |
| 64 // private slot is loaded for a user. |
| 65 // TODO(tbarzic): Make this check cert slot id if we start loading |
| 66 // certificates for secondary users. |
60 static std::string GetPkcs11IdForCert(const net::X509Certificate& cert); | 67 static std::string GetPkcs11IdForCert(const net::X509Certificate& cert); |
61 | 68 |
62 // Starts the CertLoader with the NSS cert database. | 69 // Starts the CertLoader with the NSS cert database. |
63 // The CertLoader will _not_ take the ownership of the database, but it | 70 // The CertLoader will _not_ take the ownership of the database, but it |
64 // expects it to stay alive at least until the shutdown starts on the main | 71 // expects it to stay alive at least until the shutdown starts on the main |
65 // thread. This assumes that |StartWithNSSDB| and other methods directly | 72 // thread. This assumes that |StartWithNSSDB| and other methods directly |
66 // using |database_| are not called during shutdown. | 73 // using |database_| are not called during shutdown. |
67 void StartWithNSSDB(net::NSSCertDatabase* database); | 74 void StartWithNSSDB(net::NSSCertDatabase* database); |
68 | 75 |
69 void AddObserver(CertLoader::Observer* observer); | 76 void AddObserver(CertLoader::Observer* observer); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 base::ThreadChecker thread_checker_; | 134 base::ThreadChecker thread_checker_; |
128 | 135 |
129 base::WeakPtrFactory<CertLoader> weak_factory_; | 136 base::WeakPtrFactory<CertLoader> weak_factory_; |
130 | 137 |
131 DISALLOW_COPY_AND_ASSIGN(CertLoader); | 138 DISALLOW_COPY_AND_ASSIGN(CertLoader); |
132 }; | 139 }; |
133 | 140 |
134 } // namespace chromeos | 141 } // namespace chromeos |
135 | 142 |
136 #endif // CHROMEOS_CERT_LOADER_H_ | 143 #endif // CHROMEOS_CERT_LOADER_H_ |
OLD | NEW |