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