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
3 // found in the LICENSE file.
5 #include "net/base/cert_database.h"
7 #include <openssl/x509.h>
9 #include "base/logging.h"
10 #include "base/observer_list_threadsafe.h"
11 #include "net/base/crypto_module.h"
12 #include "net/base/net_errors.h"
13 #include "net/base/openssl_private_key_store.h"
14 #include "net/base/x509_certificate.h"
18 CertDatabase::CertDatabase()
19 : observer_list_(new ObserverListThreadSafe
<Observer
>) {
22 CertDatabase::~CertDatabase() {}
24 int CertDatabase::CheckUserCert(X509Certificate
* cert
) {
26 return ERR_CERT_INVALID
;
27 if (cert
->HasExpired())
28 return ERR_CERT_DATE_INVALID
;
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
;
37 int CertDatabase::AddUserCert(X509Certificate
* cert
) {
39 return ERR_NOT_IMPLEMENTED
;