Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: net/base/cert_database_openssl.cc

Issue 11031043: Fix handling of user and CA certificates on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/android/network_library.cc ('k') | net/base/mime_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 7 #include <openssl/x509.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/observer_list_threadsafe.h" 10 #include "base/observer_list_threadsafe.h"
11 #include "net/base/crypto_module.h" 11 #include "net/base/crypto_module.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 #include "net/base/openssl_private_key_store.h" 13 #include "net/base/openssl_private_key_store.h"
14 #include "net/base/x509_certificate.h" 14 #include "net/base/x509_certificate.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 CertDatabase::CertDatabase() 18 CertDatabase::CertDatabase()
19 : observer_list_(new ObserverListThreadSafe<Observer>) { 19 : observer_list_(new ObserverListThreadSafe<Observer>) {
20 } 20 }
21 21
22 CertDatabase::~CertDatabase() {} 22 CertDatabase::~CertDatabase() {}
23 23
24 // NOTE: On Android, these two methods should _never_ be called.
25 //
26 // They are only used by the SSLAddCertHandler class on other platforms,
27 // to handle veritication and installation of downloaded certificates.
28 //
29 // On Android, the certificate data is passed directly to the system's
30 // CertInstaller activity, which handles verification, naming,
31 // installation and UI (for success/failure).
32
24 int CertDatabase::CheckUserCert(X509Certificate* cert) { 33 int CertDatabase::CheckUserCert(X509Certificate* cert) {
25 if (!cert) 34 NOTIMPLEMENTED();
26 return ERR_CERT_INVALID; 35 return ERR_NOT_IMPLEMENTED;
27 if (cert->HasExpired())
28 return ERR_CERT_DATE_INVALID;
29
30 if (!OpenSSLPrivateKeyStore::GetInstance()->FetchPrivateKey(
31 X509_PUBKEY_get(X509_get_X509_PUBKEY(cert->os_cert_handle()))))
32 return ERR_NO_PRIVATE_KEY_FOR_CERT;
33
34 return OK;
35 } 36 }
36 37
37 int CertDatabase::AddUserCert(X509Certificate* cert) { 38 int CertDatabase::AddUserCert(X509Certificate* cert) {
38 // TODO(bulach): implement me.
39 NOTIMPLEMENTED(); 39 NOTIMPLEMENTED();
40 return ERR_NOT_IMPLEMENTED; 40 return ERR_NOT_IMPLEMENTED;
41 } 41 }
42 42
43 } // namespace net 43 } // namespace net
OLDNEW
« no previous file with comments | « net/android/network_library.cc ('k') | net/base/mime_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698