Bug 392790 - "In certificate selection dialogs, also show e-mail addresses from the subjectAltName extension" [p=mozbugzilla@velox.ch (Kaspar Brand) r=kaie sr=rrelyea a1.9=sayrer]

This commit is contained in:
reed@reedloden.com 2007-10-13 00:46:11 -07:00
parent 0531294139
commit a647c41131
2 changed files with 42 additions and 1 deletions

View File

@ -348,6 +348,7 @@ CertInfoValid=Valid
CertInfoFrom=from
CertInfoTo=to
CertInfoPurposes=Purposes
CertInfoEmail=Email
CertInfoStoredIn=Stored in:
P12DefaultNickname=Imported Certificate
CrlImportFailure1x=The application cannot import the Certificate Revocation List (CRL).

View File

@ -442,6 +442,44 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni
details.Append(PRUnichar('\n'));
}
PRUint32 num;
PRUnichar **emailAddr = NULL;
if (NS_SUCCEEDED(GetEmailAddresses(&num, &emailAddr)) && num > 0) {
details.AppendLiteral(" ");
if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString("CertInfoEmail", info))) {
details.Append(info);
details.AppendLiteral(": ");
}
details.Append(*emailAddr);
/*
* If the first email address from the subject DN is also present
* in the subjectAltName extension, GetEmailAddresses() will return
* it twice (as received from NSS). Remember the first address so that
* we can filter out duplicates later on.
*/
PRUnichar *firstEmail = *emailAddr;
emailAddr++;
num--;
/* append remaining addresses */
while (num > 0) {
if (!nsDependentString(firstEmail).Equals(nsDependentString(*emailAddr))) {
details.AppendLiteral(", ");
details.Append(*emailAddr);
}
nsMemory::Free(*emailAddr);
*emailAddr = nsnull;
emailAddr++;
num--;
}
details.Append(PRUnichar('\n'));
nsMemory::Free(firstEmail);
}
nsMemory::Free(emailAddr);
emailAddr = nsnull;
if (NS_SUCCEEDED(nssComponent->GetPIPNSSBundleString("CertInfoIssuedBy", info))) {
details.Append(info);
details.Append(PRUnichar(' '));
@ -463,12 +501,14 @@ nsNSSCertificate::FormatUIStrings(const nsAutoString &nickname, nsAutoString &ni
}
/*
the above produces output the following output:
the above produces the following output:
Issued to: $subjectName
Serial number: $serialNumber
Valid from: $starting_date to $expiration_date
Purposes: $purposes
Certificate Key usage: $usages
Email: $address(es)
Issued by: $issuerName
Stored in: $token
*/