| 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 NET_CERT_NSS_CERT_DATABASE_H_ | 5 #ifndef NET_CERT_NSS_CERT_DATABASE_H_ |
| 6 #define NET_CERT_NSS_CERT_DATABASE_H_ | 6 #define NET_CERT_NSS_CERT_DATABASE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "net/cert/cert_type.h" | 22 #include "net/cert/cert_type.h" |
| 23 #include "net/cert/x509_certificate.h" | 23 #include "net/cert/x509_certificate.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 template <class ObserverType> | 26 template <class ObserverType> |
| 27 class ObserverListThreadSafe; | 27 class ObserverListThreadSafe; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace net { | 30 namespace net { |
| 31 | 31 |
| 32 class CryptoModule; | |
| 33 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList; | |
| 34 | |
| 35 // Provides functions to manipulate the NSS certificate stores. | 32 // Provides functions to manipulate the NSS certificate stores. |
| 36 // Forwards notifications about certificate changes to the global CertDatabase | 33 // Forwards notifications about certificate changes to the global CertDatabase |
| 37 // singleton. | 34 // singleton. |
| 38 class NET_EXPORT NSSCertDatabase { | 35 class NET_EXPORT NSSCertDatabase { |
| 39 public: | 36 public: |
| 40 class NET_EXPORT Observer { | 37 class NET_EXPORT Observer { |
| 41 public: | 38 public: |
| 42 virtual ~Observer() {} | 39 virtual ~Observer() {} |
| 43 | 40 |
| 44 // Will be called when a certificate is added, removed, or trust settings | 41 // Will be called when a certificate is added, removed, or trust settings |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 135 |
| 139 // Get the default slot for public key data. | 136 // Get the default slot for public key data. |
| 140 crypto::ScopedPK11Slot GetPublicSlot() const; | 137 crypto::ScopedPK11Slot GetPublicSlot() const; |
| 141 | 138 |
| 142 // Get the default slot for private key or mixed private/public key data. | 139 // Get the default slot for private key or mixed private/public key data. |
| 143 // Can return NULL. | 140 // Can return NULL. |
| 144 crypto::ScopedPK11Slot GetPrivateSlot() const; | 141 crypto::ScopedPK11Slot GetPrivateSlot() const; |
| 145 | 142 |
| 146 // Get all modules. | 143 // Get all modules. |
| 147 // If |need_rw| is true, only writable modules will be returned. | 144 // If |need_rw| is true, only writable modules will be returned. |
| 148 // TODO(mattm): come up with better alternative to CryptoModuleList. | 145 virtual void ListModules(std::vector<crypto::ScopedPK11Slot>* modules, |
| 149 virtual void ListModules(CryptoModuleList* modules, bool need_rw) const; | 146 bool need_rw) const; |
| 150 | 147 |
| 151 // Import certificates and private keys from PKCS #12 blob into the module. | 148 // Import certificates and private keys from PKCS #12 blob into the module. |
| 152 // If |is_extractable| is false, mark the private key as being unextractable | 149 // If |is_extractable| is false, mark the private key as being unextractable |
| 153 // from the module. | 150 // from the module. |
| 154 // Returns OK or a network error code such as ERR_PKCS12_IMPORT_BAD_PASSWORD | 151 // Returns OK or a network error code such as ERR_PKCS12_IMPORT_BAD_PASSWORD |
| 155 // or ERR_PKCS12_IMPORT_ERROR. |imported_certs|, if non-NULL, returns a list | 152 // or ERR_PKCS12_IMPORT_ERROR. |imported_certs|, if non-NULL, returns a list |
| 156 // of certs that were imported. | 153 // of certs that were imported. |
| 157 int ImportFromPKCS12(PK11SlotInfo* slot_info, | 154 int ImportFromPKCS12(PK11SlotInfo* slot_info, |
| 158 const std::string& data, | 155 const std::string& data, |
| 159 const base::string16& password, | 156 const base::string16& password, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 const scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_; | 275 const scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_; |
| 279 | 276 |
| 280 base::WeakPtrFactory<NSSCertDatabase> weak_factory_; | 277 base::WeakPtrFactory<NSSCertDatabase> weak_factory_; |
| 281 | 278 |
| 282 DISALLOW_COPY_AND_ASSIGN(NSSCertDatabase); | 279 DISALLOW_COPY_AND_ASSIGN(NSSCertDatabase); |
| 283 }; | 280 }; |
| 284 | 281 |
| 285 } // namespace net | 282 } // namespace net |
| 286 | 283 |
| 287 #endif // NET_CERT_NSS_CERT_DATABASE_H_ | 284 #endif // NET_CERT_NSS_CERT_DATABASE_H_ |
| OLD | NEW |