Skip to content

Commit 58d5ecf

Browse files
committed
added name resolving for jurisdiction{C,ST,L}. These are used in EV certificates.
1 parent 32da5b7 commit 58d5ecf

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

  • core/src/main/java/org/bouncycastle/asn1/x500/style

core/src/main/java/org/bouncycastle/asn1/x500/style/BCStyle.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,21 @@ public class BCStyle
187187
*/
188188
public static final ASN1ObjectIdentifier UID = new ASN1ObjectIdentifier("0.9.2342.19200300.100.1.1");
189189

190+
/**
191+
* CA/Browser Forum https://cabforum.org/uploads/CA-Browser-Forum-BR-v2.0.0.pdf, Table 78
192+
*/
193+
public static final ASN1ObjectIdentifier JURISDICTION_C = new ASN1ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.3");
194+
195+
/**
196+
* CA/Browser Forum https://cabforum.org/uploads/CA-Browser-Forum-BR-v2.0.0.pdf, Table 78
197+
*/
198+
public static final ASN1ObjectIdentifier JURISDICTION_ST = new ASN1ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.2");
199+
200+
/**
201+
* CA/Browser Forum https://cabforum.org/uploads/CA-Browser-Forum-BR-v2.0.0.pdf, Table 78
202+
*/
203+
public static final ASN1ObjectIdentifier JURISDICTION_L = new ASN1ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.1");
204+
190205
/**
191206
* default look up table translating OID values into their common symbols following
192207
* the convention in RFC 2253 with a few extras
@@ -235,6 +250,9 @@ public class BCStyle
235250
DefaultSymbols.put(TELEPHONE_NUMBER, "TelephoneNumber");
236251
DefaultSymbols.put(NAME, "Name");
237252
DefaultSymbols.put(ORGANIZATION_IDENTIFIER, "organizationIdentifier");
253+
DefaultSymbols.put(JURISDICTION_C, "jurisdictionCountry");
254+
DefaultSymbols.put(JURISDICTION_ST, "jurisdictionState");
255+
DefaultSymbols.put(JURISDICTION_L, "jurisdictionLocality");
238256

239257
DefaultLookUp.put("c", C);
240258
DefaultLookUp.put("o", O);
@@ -273,6 +291,9 @@ public class BCStyle
273291
DefaultLookUp.put("telephonenumber", TELEPHONE_NUMBER);
274292
DefaultLookUp.put("name", NAME);
275293
DefaultLookUp.put("organizationidentifier", ORGANIZATION_IDENTIFIER);
294+
DefaultLookUp.put("jurisdictionCountry", JURISDICTION_C);
295+
DefaultLookUp.put("jurisdictionState", JURISDICTION_ST);
296+
DefaultLookUp.put("jurisdictionLocality", JURISDICTION_L);
276297
}
277298

278299
/**
@@ -300,11 +321,11 @@ else if (oid.equals(DATE_OF_BIRTH)) // accept time string as well as # (for com
300321
return new ASN1GeneralizedTime(value);
301322
}
302323
else if (oid.equals(C) || oid.equals(SERIALNUMBER) || oid.equals(DN_QUALIFIER)
303-
|| oid.equals(TELEPHONE_NUMBER))
324+
|| oid.equals(TELEPHONE_NUMBER) || oid.equals(JURISDICTION_C))
304325
{
305326
return new DERPrintableString(value);
306327
}
307-
328+
308329
return super.encodeStringValue(oid, value);
309330
}
310331

0 commit comments

Comments
 (0)