OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_CERT_NSS_CERT_DATABASE_CHROMEOS_ |
| 6 #define NET_CERT_NSS_CERT_DATABASE_CHROMEOS_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "crypto/scoped_nss_types.h" |
| 10 #include "net/cert/nss_cert_database.h" |
| 11 #include "net/cert/nss_profile_filter_chromeos.h" |
| 12 |
| 13 namespace net { |
| 14 class CryptoModule; |
| 15 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList; |
| 16 class X509Certificate; |
| 17 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
| 18 |
| 19 class NET_EXPORT NSSCertDatabaseChromeOS : public NSSCertDatabase { |
| 20 public: |
| 21 // Should be called only on IO thread. |
| 22 // |callback| may be run sychronously. |
| 23 static void GetForUser( |
| 24 const std::string& username_hash, |
| 25 const base::Callback<void(NSSCertDatabase*)>& callback); |
| 26 |
| 27 virtual ~NSSCertDatabaseChromeOS(); |
| 28 |
| 29 // NSSCertDatabase implementation. |
| 30 virtual void ListCerts(CertificateList* certs) OVERRIDE; |
| 31 virtual crypto::ScopedPK11Slot GetPublicSlot() const OVERRIDE; |
| 32 virtual crypto::ScopedPK11Slot GetPrivateSlot() const OVERRIDE; |
| 33 virtual void ListModules(CryptoModuleList* modules, bool need_rw) const |
| 34 OVERRIDE; |
| 35 virtual TrustBits GetCertTrust(const X509Certificate* cert, |
| 36 CertType type) const OVERRIDE; |
| 37 virtual bool IsUntrusted(const X509Certificate* cert) const OVERRIDE; |
| 38 //virtual bool SetCertTrust(const X509Certificate* cert, |
| 39 // CertType type, |
| 40 // TrustBits trust_bits) OVERRIDE; |
| 41 |
| 42 // TODO(mattm): handle trust setting, deletion, etc correctly when certs exist |
| 43 // in multiple slots. |
| 44 // TODO(mattm): handle trust setting correctly for certs in read-only slots. |
| 45 |
| 46 class Manager; |
| 47 friend class Manager; |
| 48 private: |
| 49 |
| 50 // This class should not be constructed directly. Use GetForUser. |
| 51 explicit NSSCertDatabaseChromeOS(crypto::ScopedPK11Slot public_slot); |
| 52 void SetPrivateSlot(crypto::ScopedPK11Slot private_slot); |
| 53 void OnReady(const base::Callback<void(NSSCertDatabase*)>& callback); |
| 54 |
| 55 scoped_refptr<const X509Certificate> ResolveCert(const X509Certificate* cert, |
| 56 bool need_rw) const; |
| 57 |
| 58 bool ready_; |
| 59 crypto::ScopedPK11Slot public_slot_; |
| 60 crypto::ScopedPK11Slot private_slot_; |
| 61 NSSProfileFilterChromeOS profile_filter_; |
| 62 |
| 63 typedef std::vector<base::Callback<void(NSSCertDatabase*)> > |
| 64 ReadyCallbackList; |
| 65 ReadyCallbackList ready_callback_list_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(NSSCertDatabaseChromeOS); |
| 68 }; |
| 69 |
| 70 } // namespace net |
| 71 |
| 72 #endif // NET_CERT_NSS_CERT_DATABASE_CHROMEOS_ |
OLD | NEW |