Index: net/cert/x509_certificate_nss.cc |
diff --git a/net/cert/x509_certificate_nss.cc b/net/cert/x509_certificate_nss.cc |
index ea2c3505d0a10e0607cbd03e5bcbc9ba50de13da..1019aca02fd90278fea12fd0122f3c866bad790e 100644 |
--- a/net/cert/x509_certificate_nss.cc |
+++ b/net/cert/x509_certificate_nss.cc |
@@ -17,6 +17,7 @@ |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/pickle.h" |
+#include "base/stringprintf.h" |
#include "base/time.h" |
#include "crypto/nss_util.h" |
#include "crypto/rsa_private_key.h" |
@@ -66,7 +67,7 @@ std::string X509Certificate::GetDefaultNickname(CertType type) const { |
if (type == USER_CERT && cert_handle_->slot) { |
// Find the private key for this certificate and see if it has a |
// nickname. If there is a private key, and it has a nickname, then |
- // we return that nickname. |
+ // return that nickname. |
SECKEYPrivateKey* private_key = PK11_FindPrivateKeyFromCert( |
cert_handle_->slot, |
cert_handle_, |
@@ -91,25 +92,11 @@ std::string X509Certificate::GetDefaultNickname(CertType type) const { |
break; |
} |
case USER_CERT: { |
wtc
2013/05/22 20:58:45
Nit: you can remove the curly braces for this case
Ryan Sleevi
2013/05/22 23:20:19
Done.
|
- // Create a nickname for a user certificate. |
- // We use the scheme used by Firefox: |
- // --> <subject's common name>'s <issuer's common name> ID. |
- // TODO(gspencer): internationalize this: it's wrong to |
- // hard code English. |
- |
- std::string username, ca_name; |
- char* temp_username = CERT_GetCommonName( |
- &cert_handle_->subject); |
- char* temp_ca_name = CERT_GetCommonName(&cert_handle_->issuer); |
- if (temp_username) { |
- username = temp_username; |
- PORT_Free(temp_username); |
- } |
- if (temp_ca_name) { |
- ca_name = temp_ca_name; |
- PORT_Free(temp_ca_name); |
- } |
- result = username + "'s " + ca_name + " ID"; |
+ // TODO(gspencer): Internationalize this. It's wrong to assume English |
+ // here. |
+ result = base::StringPrintf("%s's %s ID", |
+ subject_.GetDisplayName().c_str(), |
+ issuer_.GetDisplayName().c_str()); |
wtc
2013/05/22 20:58:45
Is this change to fix the problem that the common
Ryan Sleevi
2013/05/22 23:20:19
Yes. Made the code simpler to fix while I was here
|
break; |
} |
case SERVER_CERT: |