| 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 CHROME_BROWSER_CHROMEOS_CROS_CERT_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_CERT_LIBRARY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_CERT_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_CERT_LIBRARY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 bool CertificatesLoaded() const; | 61 bool CertificatesLoaded() const; |
| 62 | 62 |
| 63 // Returns true if the TPM is available for hardware-backed certificates. | 63 // Returns true if the TPM is available for hardware-backed certificates. |
| 64 bool IsHardwareBacked() const; | 64 bool IsHardwareBacked() const; |
| 65 | 65 |
| 66 // Retruns the number of certificates available for |type|. | 66 // Retruns the number of certificates available for |type|. |
| 67 int NumCertificates(CertType type) const; | 67 int NumCertificates(CertType type) const; |
| 68 | 68 |
| 69 // Retreives the certificate property for |type| at |index|. | 69 // Retreives the certificate property for |type| at |index|. |
| 70 string16 GetCertDisplayStringAt(CertType type, int index) const; | 70 string16 GetCertDisplayStringAt(CertType type, int index) const; |
| 71 std::string GetCertNicknameAt(CertType type, int index) const; | 71 std::string GetCertFingerprintAt(CertType type, int index) const; |
| 72 std::string GetCertPkcs11IdAt(CertType type, int index) const; | 72 std::string GetCertPkcs11IdAt(CertType type, int index) const; |
| 73 bool IsCertHardwareBackedAt(CertType type, int index) const; | 73 bool IsCertHardwareBackedAt(CertType type, int index) const; |
| 74 | 74 |
| 75 // Returns the index of a Certificate matching |nickname| or -1 if none found. | 75 // Returns the index of a Certificate matching |fingerprint| or -1 if none |
| 76 int GetCertIndexByNickname(CertType type, const std::string& nickname) const; | 76 // found. |
| 77 int GetCertIndexByFingerprint(CertType type, |
| 78 const std::string& fingerprint) const; |
| 77 // Same as above but for a PKCS#11 id. TODO(stevenjb): Replace this with a | 79 // Same as above but for a PKCS#11 id. TODO(stevenjb): Replace this with a |
| 78 // better mechanism for uniquely idientifying certificates, crbug.com/236978. | 80 // better mechanism for uniquely idientifying certificates, crbug.com/236978. |
| 79 int GetCertIndexByPkcs11Id(CertType type, const std::string& pkcs11_id) const; | 81 int GetCertIndexByPkcs11Id(CertType type, const std::string& pkcs11_id) const; |
| 80 | 82 |
| 81 // CertLoader::Observer | 83 // CertLoader::Observer |
| 82 virtual void OnCertificatesLoaded(const net::CertificateList&, | 84 virtual void OnCertificatesLoaded(const net::CertificateList&, |
| 83 bool initial_load) OVERRIDE; | 85 bool initial_load) OVERRIDE; |
| 84 | 86 |
| 85 private: | 87 private: |
| 86 CertLibrary(); | 88 CertLibrary(); |
| 87 virtual ~CertLibrary(); | 89 virtual ~CertLibrary(); |
| 88 | 90 |
| 89 net::X509Certificate* GetCertificateAt(CertType type, int index) const; | 91 net::X509Certificate* GetCertificateAt(CertType type, int index) const; |
| 90 const net::CertificateList& GetCertificateListForType(CertType type) const; | 92 const net::CertificateList& GetCertificateListForType(CertType type) const; |
| 91 | 93 |
| 92 ObserverList<CertLibrary::Observer> observer_list_; | 94 ObserverList<CertLibrary::Observer> observer_list_; |
| 93 | 95 |
| 94 // Sorted certificate lists | 96 // Sorted certificate lists |
| 95 net::CertificateList certs_; | 97 net::CertificateList certs_; |
| 96 net::CertificateList user_certs_; | 98 net::CertificateList user_certs_; |
| 97 net::CertificateList server_certs_; | 99 net::CertificateList server_certs_; |
| 98 net::CertificateList server_ca_certs_; | 100 net::CertificateList server_ca_certs_; |
| 99 | 101 |
| 100 DISALLOW_COPY_AND_ASSIGN(CertLibrary); | 102 DISALLOW_COPY_AND_ASSIGN(CertLibrary); |
| 101 }; | 103 }; |
| 102 | 104 |
| 103 } // namespace chromeos | 105 } // namespace chromeos |
| 104 | 106 |
| 105 #endif // CHROME_BROWSER_CHROMEOS_CROS_CERT_LIBRARY_H_ | 107 #endif // CHROME_BROWSER_CHROMEOS_CROS_CERT_LIBRARY_H_ |
| OLD | NEW |