Skip to content

Commit

Permalink
Actually call psm::RegisterDynamicOids().
Browse files Browse the repository at this point in the history
Register the OIDs for the businessCategory and incorporationCountry
attributes.

Add a case for SEC_OID_UNKNOWN as a safety net.

R=mattm@chromium.org
BUG=88612
TEST=On Linux, visit https://servicios.izenpe.com/ and view the certificate.
The subject field should have:
businessCategory = Business Entity
incorporationCountry = ES

Review URL: http://codereview.chromium.org/7313019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91722 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
wtc@chromium.org committed Jul 7, 2011
1 parent 4990cf2 commit bdc56e1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -2938,6 +2938,12 @@ are declared in build/common.gypi.
<message translateable="false" name="IDS_CERT_OID_PKCS9_EMAIL_ADDRESS" desc="">
E
</message>
<message translateable="false" name="IDS_CERT_OID_BUSINESS_CATEGORY" desc="">
businessCategory
</message>
<message translateable="false" name="IDS_CERT_OID_EV_INCORPORATION_COUNTRY" desc="">
incorporationCountry
</message>

<message name="IDS_CERT_OID_PKCS1_RSA_ENCRYPTION" desc="description of public key algorithm SEC_OID_PKCS1_RSA_ENCRYPTION">
PKCS #1 RSA Encryption
Expand Down
1 change: 1 addition & 0 deletions chrome/common/net/x509_certificate_model_nss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) {
}

void RegisterDynamicOids() {
psm::RegisterDynamicOids();
}

} // namespace x509_certificate_model
18 changes: 17 additions & 1 deletion chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ SECOidTag eku_ms_lifetime_signing = SEC_OID_UNKNOWN;
SECOidTag eku_ms_smart_card_logon = SEC_OID_UNKNOWN;
SECOidTag eku_ms_key_recovery_agent = SEC_OID_UNKNOWN;
SECOidTag eku_netscape_international_step_up = SEC_OID_UNKNOWN;
SECOidTag cert_attribute_business_category = SEC_OID_UNKNOWN;
SECOidTag cert_attribute_ev_incorporation_country = SEC_OID_UNKNOWN;

void RegisterDynamicOids() {
if (ms_cert_ext_certtype != SEC_OID_UNKNOWN)
Expand All @@ -125,7 +127,7 @@ void RegisterDynamicOids() {
ms_cert_ext_certtype = RegisterDynamicOid("1.3.6.1.4.1.311.20.2");
ms_certsrv_ca_version = RegisterDynamicOid("1.3.6.1.4.1.311.21.1");
ms_nt_principal_name = RegisterDynamicOid("1.3.6.1.4.1.311.20.2.3");
ms_nt_principal_name = RegisterDynamicOid("1.3.6.1.4.1.311.25.1");
ms_ntds_replication = RegisterDynamicOid("1.3.6.1.4.1.311.25.1");

eku_ms_individual_code_signing = RegisterDynamicOid("1.3.6.1.4.1.311.2.1.21");
eku_ms_commercial_code_signing = RegisterDynamicOid("1.3.6.1.4.1.311.2.1.22");
Expand All @@ -145,6 +147,13 @@ void RegisterDynamicOids() {
eku_ms_key_recovery_agent = RegisterDynamicOid("1.3.6.1.4.1.311.21.6");
eku_netscape_international_step_up = RegisterDynamicOid(
"2.16.840.1.113730.4.1");

// These two OIDs will be built-in as SEC_OID_BUSINESS_CATEGORY and
// SEC_OID_EV_INCORPORATION_COUNTRY starting in NSS 3.13. Until then,
// we need to add them dynamically.
cert_attribute_business_category = RegisterDynamicOid("2.5.4.15");
cert_attribute_ev_incorporation_country = RegisterDynamicOid(
"1.3.6.1.4.1.311.60.2.1.3");
}

std::string DumpOidString(SECItem* oid) {
Expand Down Expand Up @@ -318,6 +327,9 @@ std::string GetOIDText(SECItem* oid) {
case SEC_OID_PKIX_USER_NOTICE_QUALIFIER:
string_id = IDS_CERT_PKIX_USER_NOTICE_QUALIFIER;
break;
case SEC_OID_UNKNOWN:
string_id = -1;
break;

// There are a billionty other OIDs we could add here. I tried to get the
// important ones...
Expand Down Expand Up @@ -360,6 +372,10 @@ std::string GetOIDText(SECItem* oid) {
string_id = IDS_CERT_EKU_MS_KEY_RECOVERY_AGENT;
else if (oid_tag == eku_netscape_international_step_up)
string_id = IDS_CERT_EKU_NETSCAPE_INTERNATIONAL_STEP_UP;
else if (oid_tag == cert_attribute_business_category)
string_id = IDS_CERT_OID_BUSINESS_CATEGORY;
else if (oid_tag == cert_attribute_ev_incorporation_country)
string_id = IDS_CERT_OID_EV_INCORPORATION_COUNTRY;
else
string_id = -1;
break;
Expand Down

0 comments on commit bdc56e1

Please sign in to comment.