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 #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 "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/base/openssl_private_key_store.h" |
8 #include "net/base/x509_certificate.h" | 12 #include "net/base/x509_certificate.h" |
9 | 13 |
10 namespace net { | 14 namespace net { |
11 | 15 |
12 CertDatabase::CertDatabase() { | 16 CertDatabase::CertDatabase() { |
13 } | 17 } |
14 | 18 |
15 int CertDatabase::CheckUserCert(X509Certificate* cert) { | 19 int CertDatabase::CheckUserCert(X509Certificate* cert) { |
16 if (!cert) | 20 if (!cert) |
17 return ERR_CERT_INVALID; | 21 return ERR_CERT_INVALID; |
18 if (cert->HasExpired()) | 22 if (cert->HasExpired()) |
19 return ERR_CERT_DATE_INVALID; | 23 return ERR_CERT_DATE_INVALID; |
20 | 24 |
21 // TODO(bulach): implement me. | 25 if (!OpenSSLPrivateKeyStore::GetInstance()->FetchPrivateKey( |
22 return ERR_NOT_IMPLEMENTED; | 26 X509_PUBKEY_get(X509_get_X509_PUBKEY(cert->os_cert_handle())))) |
| 27 return ERR_NO_PRIVATE_KEY_FOR_CERT; |
| 28 |
| 29 return OK; |
23 } | 30 } |
24 | 31 |
25 int CertDatabase::AddUserCert(X509Certificate* cert) { | 32 int CertDatabase::AddUserCert(X509Certificate* cert) { |
26 // TODO(bulach): implement me. | 33 // TODO(bulach): implement me. |
| 34 NOTIMPLEMENTED(); |
27 return ERR_NOT_IMPLEMENTED; | 35 return ERR_NOT_IMPLEMENTED; |
28 } | 36 } |
29 | 37 |
30 void CertDatabase::ListCerts(CertificateList* certs) { | 38 void CertDatabase::ListCerts(CertificateList* certs) { |
31 // TODO(bulach): implement me. | 39 // TODO(bulach): implement me. |
| 40 NOTIMPLEMENTED(); |
32 } | 41 } |
33 | 42 |
34 int CertDatabase::ImportFromPKCS12(const std::string& data, | 43 int CertDatabase::ImportFromPKCS12(const std::string& data, |
35 const string16& password) { | 44 const string16& password) { |
36 // TODO(bulach): implement me. | 45 // TODO(bulach): implement me. |
| 46 NOTIMPLEMENTED(); |
37 return ERR_NOT_IMPLEMENTED; | 47 return ERR_NOT_IMPLEMENTED; |
38 } | 48 } |
39 | 49 |
40 int CertDatabase::ExportToPKCS12(const CertificateList& certs, | 50 int CertDatabase::ExportToPKCS12(const CertificateList& certs, |
41 const string16& password, | 51 const string16& password, |
42 std::string* output) const { | 52 std::string* output) const { |
43 // TODO(bulach): implement me. | 53 // TODO(bulach): implement me. |
| 54 NOTIMPLEMENTED(); |
44 return 0; | 55 return 0; |
45 } | 56 } |
46 | 57 |
47 bool CertDatabase::DeleteCertAndKey(const X509Certificate* cert) { | 58 bool CertDatabase::DeleteCertAndKey(const X509Certificate* cert) { |
48 // TODO(bulach): implement me. | 59 // TODO(bulach): implement me. |
| 60 NOTIMPLEMENTED(); |
49 return false; | 61 return false; |
50 } | 62 } |
51 | 63 |
52 unsigned int CertDatabase::GetCertTrust(const X509Certificate* cert, | 64 unsigned int CertDatabase::GetCertTrust(const X509Certificate* cert, |
53 CertType type) const { | 65 CertType type) const { |
54 // TODO(bulach): implement me. | 66 // TODO(bulach): implement me. |
55 // NOTE: This method is currently only declared for USE_NSS builds. | 67 NOTIMPLEMENTED(); |
56 return 0; | 68 return 0; |
57 } | 69 } |
58 | 70 |
59 bool CertDatabase::SetCertTrust(const X509Certificate* cert, | 71 bool CertDatabase::SetCertTrust(const X509Certificate* cert, |
60 CertType type, | 72 CertType type, |
61 unsigned int trust_bits) { | 73 unsigned int trust_bits) { |
62 // TODO(bulach): implement me. | 74 // TODO(bulach): implement me. |
63 // NOTE: This method is currently only declared for USE_NSS builds. | 75 NOTIMPLEMENTED(); |
64 return false; | 76 return false; |
65 } | 77 } |
66 | 78 |
67 } // namespace net | 79 } // namespace net |
OLD | NEW |