Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.x500.style;
  
  
 
 public class BCStyle
     extends AbstractX500NameStyle
 {
    
country code - StringType(SIZE(2))
 
     public static final ASN1ObjectIdentifier C = new ASN1ObjectIdentifier("2.5.4.6");

    
organization - StringType(SIZE(1..64))
 
     public static final ASN1ObjectIdentifier O = new ASN1ObjectIdentifier("2.5.4.10");

    
organizational unit name - StringType(SIZE(1..64))
 
     public static final ASN1ObjectIdentifier OU = new ASN1ObjectIdentifier("2.5.4.11");

    
Title
 
     public static final ASN1ObjectIdentifier T = new ASN1ObjectIdentifier("2.5.4.12");

    
common name - StringType(SIZE(1..64))
 
     public static final ASN1ObjectIdentifier CN = new ASN1ObjectIdentifier("2.5.4.3");

    
device serial number name - StringType(SIZE(1..64))
 
     public static final ASN1ObjectIdentifier SN = new ASN1ObjectIdentifier("2.5.4.5");

    
street - StringType(SIZE(1..64))
 
     public static final ASN1ObjectIdentifier STREET = new ASN1ObjectIdentifier("2.5.4.9");

    
device serial number name - StringType(SIZE(1..64))
 
     public static final ASN1ObjectIdentifier SERIALNUMBER = ;

    
locality name - StringType(SIZE(1..64))
 
     public static final ASN1ObjectIdentifier L = new ASN1ObjectIdentifier("2.5.4.7");

    
state, or province name - StringType(SIZE(1..64))
 
     public static final ASN1ObjectIdentifier ST = new ASN1ObjectIdentifier("2.5.4.8");

    
Naming attributes of type X520name
 
     public static final ASN1ObjectIdentifier SURNAME = new ASN1ObjectIdentifier("2.5.4.4");
     public static final ASN1ObjectIdentifier GIVENNAME = new ASN1ObjectIdentifier("2.5.4.42");
     public static final ASN1ObjectIdentifier INITIALS = new ASN1ObjectIdentifier("2.5.4.43");
     public static final ASN1ObjectIdentifier GENERATION = new ASN1ObjectIdentifier("2.5.4.44");
     public static final ASN1ObjectIdentifier UNIQUE_IDENTIFIER = new ASN1ObjectIdentifier("2.5.4.45");

    
businessCategory - DirectoryString(SIZE(1..128)
 
     public static final ASN1ObjectIdentifier BUSINESS_CATEGORY = new ASN1ObjectIdentifier(
         "2.5.4.15");

    
postalCode - DirectoryString(SIZE(1..40)
 
     public static final ASN1ObjectIdentifier POSTAL_CODE = new ASN1ObjectIdentifier(
         "2.5.4.17");

    
dnQualifier - DirectoryString(SIZE(1..64)
 
     public static final ASN1ObjectIdentifier DN_QUALIFIER = new ASN1ObjectIdentifier(
         "2.5.4.46");

    
RFC 3039 Pseudonym - DirectoryString(SIZE(1..64)
 
     public static final ASN1ObjectIdentifier PSEUDONYM = new ASN1ObjectIdentifier(
        "2.5.4.65");


    
RFC 3039 DateOfBirth - GeneralizedTime - YYYYMMDD000000Z
    public static final ASN1ObjectIdentifier DATE_OF_BIRTH = new ASN1ObjectIdentifier(
        "1.3.6.1.5.5.7.9.1");

    
RFC 3039 PlaceOfBirth - DirectoryString(SIZE(1..128)
    public static final ASN1ObjectIdentifier PLACE_OF_BIRTH = new ASN1ObjectIdentifier(
        "1.3.6.1.5.5.7.9.2");

    
RFC 3039 Gender - PrintableString (SIZE(1)) -- "M", "F", "m" or "f"
    public static final ASN1ObjectIdentifier GENDER = new ASN1ObjectIdentifier(
        "1.3.6.1.5.5.7.9.3");

    
RFC 3039 CountryOfCitizenship - PrintableString (SIZE (2)) -- ISO 3166 codes only
    public static final ASN1ObjectIdentifier COUNTRY_OF_CITIZENSHIP = new ASN1ObjectIdentifier(
        "1.3.6.1.5.5.7.9.4");

    
RFC 3039 CountryOfResidence - PrintableString (SIZE (2)) -- ISO 3166 codes only
    public static final ASN1ObjectIdentifier COUNTRY_OF_RESIDENCE = new ASN1ObjectIdentifier(
        "1.3.6.1.5.5.7.9.5");


    
ISIS-MTT NameAtBirth - DirectoryString(SIZE(1..64)
    public static final ASN1ObjectIdentifier NAME_AT_BIRTH = new ASN1ObjectIdentifier("1.3.36.8.3.14");

    
RFC 3039 PostalAddress - SEQUENCE SIZE (1..6) OF DirectoryString(SIZE(1..30))
    public static final ASN1ObjectIdentifier POSTAL_ADDRESS = new ASN1ObjectIdentifier("2.5.4.16");

    
RFC 2256 dmdName
    public static final ASN1ObjectIdentifier DMD_NAME = new ASN1ObjectIdentifier("2.5.4.54");

    
id-at-telephoneNumber
id-at-name
    public static final ASN1ObjectIdentifier NAME = .;

    
Email address (RSA PKCS#9 extension) - IA5String.

Note: if you're trying to be ultra orthodox, don't use this! It shouldn't be in here.

more from PKCS#9
email address in Verisign certificates
    public static final ASN1ObjectIdentifier E = ;
    /*
    * others...
    */
    public static final ASN1ObjectIdentifier DC = new ASN1ObjectIdentifier("0.9.2342.19200300.100.1.25");

    
LDAP User id.
    public static final ASN1ObjectIdentifier UID = new ASN1ObjectIdentifier("0.9.2342.19200300.100.1.1");

    
default look up table translating OID values into their common symbols following the convention in RFC 2253 with a few extras
    private static final Hashtable DefaultSymbols = new Hashtable();

    
look up table translating common symbols into their OIDS.
    private static final Hashtable DefaultLookUp = new Hashtable();
    static
    {
        .put("C");
        .put("O");
        .put("T");
        .put("OU");
        .put("CN");
        .put("L");
        .put("ST");
        .put("SERIALNUMBER");
        .put("E");
        .put("DC");
        .put("UID");
        .put("STREET");
        .put("SURNAME");
        .put("GIVENNAME");
        .put("INITIALS");
        .put("GENERATION");
        .put("unstructuredAddress");
        .put("unstructuredName");
        .put("UniqueIdentifier");
        .put("DN");
        .put("Pseudonym");
        .put("PostalAddress");
        .put("NameAtBirth");
        .put("CountryOfCitizenship");
        .put("CountryOfResidence");
        .put("Gender");
        .put("PlaceOfBirth");
        .put("DateOfBirth");
        .put("PostalCode");
        .put("BusinessCategory");
        .put("TelephoneNumber");
        .put("Name");
        .put("c");
        .put("o");
        .put("t");
        .put("ou");
        .put("cn");
        .put("l");
        .put("st");
        .put("sn");
        .put("serialnumber");
        .put("street");
        .put("emailaddress");
        .put("dc");
        .put("e");
        .put("uid");
        .put("surname");
        .put("givenname");
        .put("initials");
        .put("generation");
        .put("unstructuredaddress");
        .put("unstructuredname");
        .put("uniqueidentifier");
        .put("dn");
        .put("pseudonym");
        .put("postaladdress");
        .put("nameofbirth");
        .put("countryofcitizenship");
        .put("countryofresidence");
        .put("gender");
        .put("placeofbirth");
        .put("dateofbirth");
        .put("postalcode");
        .put("businesscategory");
        .put("telephonenumber");
        .put("name");
    }

    
Singleton instance.
    public static final X500NameStyle INSTANCE = new BCStyle();
    protected final Hashtable defaultLookUp;
    protected final Hashtable defaultSymbols;
    protected BCStyle()
    {
    }
    		String value) {
    	if (oid.equals() || oid.equals())
        {
            return new DERIA5String(value);
        }
        else if (oid.equals())  // accept time string as well as # (for compatibility)
        {
            return new ASN1GeneralizedTime(value);
        }
        else if (oid.equals() || oid.equals() || oid.equals()
            || oid.equals())
        {
            return new DERPrintableString(value);
        }
    	
    	return super.encodeStringValue(oidvalue);
    }
    {
        return (String).get(oid);
    }
    {
        return IETFUtils.findAttrNamesForOID(oid);
    }
    public ASN1ObjectIdentifier attrNameToOID(String attrName)
    {
        return IETFUtils.decodeAttrName(attrName);
    }
    public RDN[] fromString(String dirName)
    {
        return IETFUtils.rDNsFromString(dirNamethis);
    }
    public String toString(X500Name name)
    {
        StringBuffer buf = new StringBuffer();
        boolean first = true;
        RDN[] rdns = name.getRDNs();
        for (int i = 0; i < rdns.lengthi++)
        {
            if (first)
            {
                first = false;
            }
            else
            {
                buf.append(',');
            }
            IETFUtils.appendRDN(bufrdns[i], );
        }
        return buf.toString();
    }
New to GrepCode? Check out our FAQ X