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

Side by Side Diff: net/cert/nss_cert_database.cc

Issue 2600053002: net: change ImportFromPKCS12() to take a PK11SlotInfo* (Closed)
Patch Set: REBASE Created 3 years, 11 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
« no previous file with comments | « net/cert/nss_cert_database.h ('k') | net/cert/nss_cert_database_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/cert/nss_cert_database.h" 5 #include "net/cert/nss_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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 169 }
170 170
171 PK11SlotListElement* slot_element = PK11_GetFirstSafe(slot_list.get()); 171 PK11SlotListElement* slot_element = PK11_GetFirstSafe(slot_list.get());
172 while (slot_element) { 172 while (slot_element) {
173 modules->push_back(CryptoModule::CreateFromHandle(slot_element->slot)); 173 modules->push_back(CryptoModule::CreateFromHandle(slot_element->slot));
174 slot_element = PK11_GetNextSafe(slot_list.get(), slot_element, 174 slot_element = PK11_GetNextSafe(slot_list.get(), slot_element,
175 PR_FALSE); // restart 175 PR_FALSE); // restart
176 } 176 }
177 } 177 }
178 178
179 int NSSCertDatabase::ImportFromPKCS12(CryptoModule* module, 179 int NSSCertDatabase::ImportFromPKCS12(PK11SlotInfo* slot_info,
180 const std::string& data, 180 const std::string& data,
181 const base::string16& password, 181 const base::string16& password,
182 bool is_extractable, 182 bool is_extractable,
183 CertificateList* imported_certs) { 183 CertificateList* imported_certs) {
184 DVLOG(1) << __func__ << " " 184 DVLOG(1) << __func__ << " "
185 << PK11_GetModuleID(module->os_module_handle()) << ":" 185 << PK11_GetModuleID(slot_info) << ":"
186 << PK11_GetSlotID(module->os_module_handle()); 186 << PK11_GetSlotID(slot_info);
187 int result = psm::nsPKCS12Blob_Import(module->os_module_handle(), 187 int result = psm::nsPKCS12Blob_Import(slot_info,
188 data.data(), data.size(), 188 data.data(), data.size(),
189 password, 189 password,
190 is_extractable, 190 is_extractable,
191 imported_certs); 191 imported_certs);
192 if (result == OK) 192 if (result == OK)
193 NotifyObserversCertDBChanged(NULL); 193 NotifyObserversCertDBChanged(NULL);
194 194
195 return result; 195 return result;
196 } 196 }
197 197
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 } else { 481 } else {
482 if (SEC_DeletePermCertificate(cert->os_cert_handle())) { 482 if (SEC_DeletePermCertificate(cert->os_cert_handle())) {
483 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError(); 483 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError();
484 return false; 484 return false;
485 } 485 }
486 } 486 }
487 return true; 487 return true;
488 } 488 }
489 489
490 } // namespace net 490 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/nss_cert_database.h ('k') | net/cert/nss_cert_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698