| 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> | 7 #include <openssl/x509.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "net/base/crypto_module.h" | 10 #include "net/base/crypto_module.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/base/openssl_private_key_store.h" | 12 #include "net/base/openssl_private_key_store.h" |
| 13 #include "net/base/x509_certificate.h" | 13 #include "net/base/x509_certificate.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 CertDatabase::CertDatabase() { | |
| 18 } | |
| 19 | |
| 20 int CertDatabase::CheckUserCert(X509Certificate* cert) { | 17 int CertDatabase::CheckUserCert(X509Certificate* cert) { |
| 21 if (!cert) | 18 if (!cert) |
| 22 return ERR_CERT_INVALID; | 19 return ERR_CERT_INVALID; |
| 23 if (cert->HasExpired()) | 20 if (cert->HasExpired()) |
| 24 return ERR_CERT_DATE_INVALID; | 21 return ERR_CERT_DATE_INVALID; |
| 25 | 22 |
| 26 if (!OpenSSLPrivateKeyStore::GetInstance()->FetchPrivateKey( | 23 if (!OpenSSLPrivateKeyStore::GetInstance()->FetchPrivateKey( |
| 27 X509_PUBKEY_get(X509_get_X509_PUBKEY(cert->os_cert_handle())))) | 24 X509_PUBKEY_get(X509_get_X509_PUBKEY(cert->os_cert_handle())))) |
| 28 return ERR_NO_PRIVATE_KEY_FOR_CERT; | 25 return ERR_NO_PRIVATE_KEY_FOR_CERT; |
| 29 | 26 |
| 30 return OK; | 27 return OK; |
| 31 } | 28 } |
| 32 | 29 |
| 33 int CertDatabase::AddUserCert(X509Certificate* cert) { | 30 int CertDatabase::AddUserCert(X509Certificate* cert) { |
| 34 // TODO(bulach): implement me. | 31 // TODO(bulach): implement me. |
| 35 NOTIMPLEMENTED(); | 32 NOTIMPLEMENTED(); |
| 36 return ERR_NOT_IMPLEMENTED; | 33 return ERR_NOT_IMPLEMENTED; |
| 37 } | 34 } |
| 38 | 35 |
| 39 } // namespace net | 36 } // namespace net |
| OLD | NEW |