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

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

Issue 8919020: This fixes a bug I introduced last night (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merging if statements Created 9 years 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
« no previous file with comments | « net/base/cert_database_nss.cc ('k') | no next file » | 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) 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/x509_certificate.h" 5 #include "net/base/x509_certificate.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <cryptohi.h> 8 #include <cryptohi.h>
9 #include <keyhi.h> 9 #include <keyhi.h>
10 #include <nss.h> 10 #include <nss.h>
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 cert->default_nickname_ = nickname; 703 cert->default_nickname_ = nickname;
704 704
705 return cert; 705 return cert;
706 } 706 }
707 707
708 std::string X509Certificate::GetDefaultNickname(CertType type) const { 708 std::string X509Certificate::GetDefaultNickname(CertType type) const {
709 if (!default_nickname_.empty()) 709 if (!default_nickname_.empty())
710 return default_nickname_; 710 return default_nickname_;
711 711
712 std::string result; 712 std::string result;
713 if (type == USER_CERT) { 713 if (type == USER_CERT && cert_handle_->slot) {
714 // Find the private key for this certificate and see if it has a 714 // Find the private key for this certificate and see if it has a
715 // nickname. If there is a private key, and it has a nickname, then 715 // nickname. If there is a private key, and it has a nickname, then
716 // we return that nickname. 716 // we return that nickname.
717 SECKEYPrivateKey* private_key = PK11_FindPrivateKeyFromCert( 717 SECKEYPrivateKey* private_key = PK11_FindPrivateKeyFromCert(
718 cert_handle_->slot, 718 cert_handle_->slot,
719 cert_handle_, 719 cert_handle_,
720 NULL); // wincx 720 NULL); // wincx
721 if (private_key) { 721 if (private_key) {
722 char* private_key_nickname = PK11_GetPrivateKeyNickname(private_key); 722 char* private_key_nickname = PK11_GetPrivateKeyNickname(private_key);
723 if (private_key_nickname) { 723 if (private_key_nickname) {
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 1136
1137 // static 1137 // static
1138 bool X509Certificate::WriteOSCertHandleToPickle(OSCertHandle cert_handle, 1138 bool X509Certificate::WriteOSCertHandleToPickle(OSCertHandle cert_handle,
1139 Pickle* pickle) { 1139 Pickle* pickle) {
1140 return pickle->WriteData( 1140 return pickle->WriteData(
1141 reinterpret_cast<const char*>(cert_handle->derCert.data), 1141 reinterpret_cast<const char*>(cert_handle->derCert.data),
1142 cert_handle->derCert.len); 1142 cert_handle->derCert.len);
1143 } 1143 }
1144 1144
1145 } // namespace net 1145 } // namespace net
OLDNEW
« no previous file with comments | « net/base/cert_database_nss.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698