| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BASE_CERT_DATABASE_H_ | 5 #ifndef NET_BASE_CERT_DATABASE_H_ |
| 6 #define NET_BASE_CERT_DATABASE_H_ | 6 #define NET_BASE_CERT_DATABASE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/string16.h" | 13 #include "base/string16.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "net/base/cert_type.h" | 15 #include "net/base/cert_type.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 class CryptoModule; | 19 class CryptoModule; |
| 20 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList; |
| 20 class X509Certificate; | 21 class X509Certificate; |
| 21 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 22 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
| 22 | 23 |
| 23 | 24 |
| 24 // This class provides functions to manipulate the local | 25 // This class provides functions to manipulate the local |
| 25 // certificate store. | 26 // certificate store. |
| 26 | 27 |
| 27 // TODO(gauravsh): This class could be augmented with methods | 28 // TODO(gauravsh): This class could be augmented with methods |
| 28 // for all operations that manipulate the underlying system | 29 // for all operations that manipulate the underlying system |
| 29 // certificate store. | 30 // certificate store. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 71 |
| 71 #if defined(USE_NSS) || defined(USE_OPENSSL) | 72 #if defined(USE_NSS) || defined(USE_OPENSSL) |
| 72 // Get a list of unique certificates in the certificate database. (One | 73 // Get a list of unique certificates in the certificate database. (One |
| 73 // instance of all certificates.) | 74 // instance of all certificates.) |
| 74 void ListCerts(CertificateList* certs); | 75 void ListCerts(CertificateList* certs); |
| 75 | 76 |
| 76 // Get the default module. | 77 // Get the default module. |
| 77 // The returned pointer must be stored in a scoped_refptr<CryptoModule>. | 78 // The returned pointer must be stored in a scoped_refptr<CryptoModule>. |
| 78 CryptoModule* GetDefaultModule() const; | 79 CryptoModule* GetDefaultModule() const; |
| 79 | 80 |
| 81 // Get all modules. |
| 82 // If |need_rw| is true, only writable modules will be returned. |
| 83 void ListModules(CryptoModuleList* modules, bool need_rw) const; |
| 84 |
| 80 // Import certificates and private keys from PKCS #12 blob into the module. | 85 // Import certificates and private keys from PKCS #12 blob into the module. |
| 81 // Returns OK or a network error code such as ERR_PKCS12_IMPORT_BAD_PASSWORD | 86 // Returns OK or a network error code such as ERR_PKCS12_IMPORT_BAD_PASSWORD |
| 82 // or ERR_PKCS12_IMPORT_ERROR. | 87 // or ERR_PKCS12_IMPORT_ERROR. |
| 83 int ImportFromPKCS12(net::CryptoModule* module, | 88 int ImportFromPKCS12(net::CryptoModule* module, |
| 84 const std::string& data, | 89 const std::string& data, |
| 85 const string16& password); | 90 const string16& password); |
| 86 | 91 |
| 87 // Export the given certificates and private keys into a PKCS #12 blob, | 92 // Export the given certificates and private keys into a PKCS #12 blob, |
| 88 // storing into |output|. | 93 // storing into |output|. |
| 89 // Returns the number of certificates successfully exported. | 94 // Returns the number of certificates successfully exported. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 bool IsReadOnly(const X509Certificate* cert) const; | 141 bool IsReadOnly(const X509Certificate* cert) const; |
| 137 #endif | 142 #endif |
| 138 | 143 |
| 139 private: | 144 private: |
| 140 DISALLOW_COPY_AND_ASSIGN(CertDatabase); | 145 DISALLOW_COPY_AND_ASSIGN(CertDatabase); |
| 141 }; | 146 }; |
| 142 | 147 |
| 143 } // namespace net | 148 } // namespace net |
| 144 | 149 |
| 145 #endif // NET_BASE_CERT_DATABASE_H_ | 150 #endif // NET_BASE_CERT_DATABASE_H_ |
| OLD | NEW |