| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <cert.h> | 7 #include <cert.h> |
| 8 #include <certdb.h> | 8 #include <certdb.h> |
| 9 #include <keyhi.h> | 9 #include <keyhi.h> |
| 10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return ERR_NO_PRIVATE_KEY_FOR_CERT; | 57 return ERR_NO_PRIVATE_KEY_FOR_CERT; |
| 58 } | 58 } |
| 59 PK11_FreeSlot(slot); | 59 PK11_FreeSlot(slot); |
| 60 | 60 |
| 61 return OK; | 61 return OK; |
| 62 } | 62 } |
| 63 | 63 |
| 64 int CertDatabase::AddUserCert(X509Certificate* cert_obj) { | 64 int CertDatabase::AddUserCert(X509Certificate* cert_obj) { |
| 65 CERTCertificate* cert = cert_obj->os_cert_handle(); | 65 CERTCertificate* cert = cert_obj->os_cert_handle(); |
| 66 PK11SlotInfo* slot = NULL; | 66 PK11SlotInfo* slot = NULL; |
| 67 std::string nickname; | |
| 68 | 67 |
| 69 { | 68 { |
| 70 crypto::AutoNSSWriteLock lock; | 69 crypto::AutoNSSWriteLock lock; |
| 71 slot = PK11_ImportCertForKey( | 70 slot = PK11_ImportCertForKey( |
| 72 cert, | 71 cert, |
| 73 cert_obj->GetDefaultNickname(net::USER_CERT).c_str(), | 72 cert_obj->GetDefaultNickname(net::USER_CERT).c_str(), |
| 74 NULL); | 73 NULL); |
| 75 } | 74 } |
| 76 | 75 |
| 77 if (!slot) { | 76 if (!slot) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 } | 312 } |
| 314 return true; | 313 return true; |
| 315 } | 314 } |
| 316 | 315 |
| 317 bool CertDatabase::IsReadOnly(const X509Certificate* cert) const { | 316 bool CertDatabase::IsReadOnly(const X509Certificate* cert) const { |
| 318 PK11SlotInfo* slot = cert->os_cert_handle()->slot; | 317 PK11SlotInfo* slot = cert->os_cert_handle()->slot; |
| 319 return slot && PK11_IsReadOnly(slot); | 318 return slot && PK11_IsReadOnly(slot); |
| 320 } | 319 } |
| 321 | 320 |
| 322 } // namespace net | 321 } // namespace net |
| OLD | NEW |