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

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

Issue 10916094: Move the NSS functions out of CertDatabase into a new NSSCertDatabase class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
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 <windows.h> 7 #include <windows.h>
8 #include <wincrypt.h> 8 #include <wincrypt.h>
9 #pragma comment(lib, "crypt32.lib") 9 #pragma comment(lib, "crypt32.lib")
10 10
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/base/x509_certificate.h" 12 #include "net/base/x509_certificate.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 CertDatabase::CertDatabase() {
17 }
18
19 int CertDatabase::CheckUserCert(X509Certificate* cert) { 16 int CertDatabase::CheckUserCert(X509Certificate* cert) {
20 if (!cert) 17 if (!cert)
21 return ERR_CERT_INVALID; 18 return ERR_CERT_INVALID;
22 if (cert->HasExpired()) 19 if (cert->HasExpired())
23 return ERR_CERT_DATE_INVALID; 20 return ERR_CERT_DATE_INVALID;
24 21
25 // TODO(rsleevi): Should CRYPT_FIND_SILENT_KEYSET_FLAG be specified? A UI 22 // TODO(rsleevi): Should CRYPT_FIND_SILENT_KEYSET_FLAG be specified? A UI
26 // may be shown here / this call may block. 23 // may be shown here / this call may block.
27 if (!CryptFindCertificateKeyProvInfo(cert->os_cert_handle(), 0, NULL)) 24 if (!CryptFindCertificateKeyProvInfo(cert->os_cert_handle(), 0, NULL))
28 return ERR_NO_PRIVATE_KEY_FOR_CERT; 25 return ERR_NO_PRIVATE_KEY_FOR_CERT;
(...skipping 14 matching lines...) Expand all
43 BOOL added = CertAddCertificateContextToStore(cert_db, 40 BOOL added = CertAddCertificateContextToStore(cert_db,
44 cert->os_cert_handle(), 41 cert->os_cert_handle(),
45 CERT_STORE_ADD_USE_EXISTING, 42 CERT_STORE_ADD_USE_EXISTING,
46 NULL); 43 NULL);
47 44
48 CertCloseStore(cert_db, 0); 45 CertCloseStore(cert_db, 0);
49 46
50 if (!added) 47 if (!added)
51 return ERR_ADD_USER_CERT_FAILED; 48 return ERR_ADD_USER_CERT_FAILED;
52 49
53 CertDatabase::NotifyObserversOfUserCertAdded(cert); 50 NotifyObserversOfCertAdded(cert);
54 return OK; 51 return OK;
55 } 52 }
56 53
57 } // namespace net 54 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698