OLD | NEW |
1 /* ***** BEGIN LICENSE BLOCK ***** | 1 /* ***** BEGIN LICENSE BLOCK ***** |
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
3 * | 3 * |
4 * The contents of this file are subject to the Mozilla Public License Version | 4 * The contents of this file are subject to the Mozilla Public License Version |
5 * 1.1 (the "License"); you may not use this file except in compliance with | 5 * 1.1 (the "License"); you may not use this file except in compliance with |
6 * the License. You may obtain a copy of the License at | 6 * the License. You may obtain a copy of the License at |
7 * http://www.mozilla.org/MPL/ | 7 * http://www.mozilla.org/MPL/ |
8 * | 8 * |
9 * Software distributed under the License is distributed on an "AS IS" basis, | 9 * Software distributed under the License is distributed on an "AS IS" basis, |
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 if (!cert) { | 218 if (!cert) { |
219 LOG(ERROR) << "Could not grab a handle to the certificate in the slot " | 219 LOG(ERROR) << "Could not grab a handle to the certificate in the slot " |
220 << "from the corresponding PKCS#12 DER certificate."; | 220 << "from the corresponding PKCS#12 DER certificate."; |
221 continue; | 221 continue; |
222 } | 222 } |
223 | 223 |
224 // Add the cert to the list | 224 // Add the cert to the list |
225 if (imported_certs) { | 225 if (imported_certs) { |
226 // Empty list of intermediates. | 226 // Empty list of intermediates. |
227 net::X509Certificate::OSCertHandles intermediates; | 227 net::X509Certificate::OSCertHandles intermediates; |
228 imported_certs->push_back( | 228 scoped_refptr<net::X509Certificate> x509_cert = |
229 net::X509Certificate::CreateFromHandle(cert, intermediates)); | 229 net::X509Certificate::CreateFromHandle(cert, intermediates); |
| 230 if (x509_cert) |
| 231 imported_certs->push_back(std::move(x509_cert)); |
230 } | 232 } |
231 | 233 |
232 // Once we have determined that the imported certificate has an | 234 // Once we have determined that the imported certificate has an |
233 // associated private key too, only then can we mark the key as | 235 // associated private key too, only then can we mark the key as |
234 // non-extractable. | 236 // non-extractable. |
235 if (!decoder_item->hasKey) { | 237 if (!decoder_item->hasKey) { |
236 CERT_DestroyCertificate(cert); | 238 CERT_DestroyCertificate(cert); |
237 continue; | 239 continue; |
238 } | 240 } |
239 | 241 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 finish: | 483 finish: |
482 if (srv) | 484 if (srv) |
483 LOG(ERROR) << "PKCS#12 export failed with error " << PORT_GetError(); | 485 LOG(ERROR) << "PKCS#12 export failed with error " << PORT_GetError(); |
484 if (ecx) | 486 if (ecx) |
485 SEC_PKCS12DestroyExportContext(ecx); | 487 SEC_PKCS12DestroyExportContext(ecx); |
486 SECITEM_ZfreeItem(&unicodePw, PR_FALSE); | 488 SECITEM_ZfreeItem(&unicodePw, PR_FALSE); |
487 return return_count; | 489 return return_count; |
488 } | 490 } |
489 | 491 |
490 } // namespace mozilla_security_manager | 492 } // namespace mozilla_security_manager |
OLD | NEW |