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 #include "net/base/cert_database.h" | 5 #include "net/base/cert_database.h" |
6 | 6 |
7 #include <openssl/x509.h> | |
8 | |
9 #include "base/logging.h" | 7 #include "base/logging.h" |
10 #include "base/observer_list_threadsafe.h" | 8 #include "base/observer_list_threadsafe.h" |
11 #include "net/base/crypto_module.h" | |
12 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
13 #include "net/base/openssl_private_key_store.h" | |
14 #include "net/base/x509_certificate.h" | |
15 | 10 |
16 namespace net { | 11 namespace net { |
17 | 12 |
18 CertDatabase::CertDatabase() | 13 CertDatabase::CertDatabase() |
19 : observer_list_(new ObserverListThreadSafe<Observer>) { | 14 : observer_list_(new ObserverListThreadSafe<Observer>) { |
20 } | 15 } |
21 | 16 |
22 CertDatabase::~CertDatabase() {} | 17 CertDatabase::~CertDatabase() {} |
23 | 18 |
24 int CertDatabase::CheckUserCert(X509Certificate* cert) { | 19 int CertDatabase::CheckUserCert(X509Certificate* cert) { |
25 if (!cert) | 20 // NOTE: This method shall never be called on Android. |
26 return ERR_CERT_INVALID; | 21 // |
27 if (cert->HasExpired()) | 22 // On other platforms, it is only used by the SSLAddCertHandler class |
28 return ERR_CERT_DATE_INVALID; | 23 // to handle veritication and installation of downloaded certificates. |
29 | 24 // |
30 if (!OpenSSLPrivateKeyStore::GetInstance()->FetchPrivateKey( | 25 // On Android, the certificate data is passed directly to the system's |
31 X509_PUBKEY_get(X509_get_X509_PUBKEY(cert->os_cert_handle())))) | 26 // CertInstaller activity, which handles verification, naming, |
32 return ERR_NO_PRIVATE_KEY_FOR_CERT; | 27 // installation and UI (for success/failure). |
33 | 28 NOTIMPLEMENTED(); |
34 return OK; | 29 return ERR_NOT_IMPLEMENTED; |
35 } | 30 } |
36 | 31 |
37 int CertDatabase::AddUserCert(X509Certificate* cert) { | 32 int CertDatabase::AddUserCert(X509Certificate* cert) { |
38 // TODO(bulach): implement me. | 33 // This method is only used by the content SSLAddCertHandler which is |
| 34 // never used on Android. |
39 NOTIMPLEMENTED(); | 35 NOTIMPLEMENTED(); |
40 return ERR_NOT_IMPLEMENTED; | 36 return ERR_NOT_IMPLEMENTED; |
41 } | 37 } |
42 | 38 |
43 } // namespace net | 39 } // namespace net |
OLD | NEW |