Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.asn1.x500.style;
  
  
 
 public class RFC4519Style
 {
     public static final ASN1ObjectIdentifier businessCategory = new ASN1ObjectIdentifier("2.5.4.15");
     public static final ASN1ObjectIdentifier c = new ASN1ObjectIdentifier("2.5.4.6");
     public static final ASN1ObjectIdentifier cn = new ASN1ObjectIdentifier("2.5.4.3");
     public static final ASN1ObjectIdentifier dc = new ASN1ObjectIdentifier("0.9.2342.19200300.100.1.25");
     public static final ASN1ObjectIdentifier description = new ASN1ObjectIdentifier("2.5.4.13");
     public static final ASN1ObjectIdentifier destinationIndicator = new ASN1ObjectIdentifier("2.5.4.27");
     public static final ASN1ObjectIdentifier distinguishedName = new ASN1ObjectIdentifier("2.5.4.49");
     public static final ASN1ObjectIdentifier dnQualifier = new ASN1ObjectIdentifier("2.5.4.46");
     public static final ASN1ObjectIdentifier enhancedSearchGuide = new ASN1ObjectIdentifier("2.5.4.47");
     public static final ASN1ObjectIdentifier facsimileTelephoneNumber = new ASN1ObjectIdentifier("2.5.4.23");
     public static final ASN1ObjectIdentifier generationQualifier = new ASN1ObjectIdentifier("2.5.4.44");
     public static final ASN1ObjectIdentifier givenName = new ASN1ObjectIdentifier("2.5.4.42");
     public static final ASN1ObjectIdentifier houseIdentifier = new ASN1ObjectIdentifier("2.5.4.51");
     public static final ASN1ObjectIdentifier initials = new ASN1ObjectIdentifier("2.5.4.43");
     public static final ASN1ObjectIdentifier internationalISDNNumber = new ASN1ObjectIdentifier("2.5.4.25");
     public static final ASN1ObjectIdentifier l = new ASN1ObjectIdentifier("2.5.4.7");
     public static final ASN1ObjectIdentifier member = new ASN1ObjectIdentifier("2.5.4.31");
     public static final ASN1ObjectIdentifier name = new ASN1ObjectIdentifier("2.5.4.41");
     public static final ASN1ObjectIdentifier o = new ASN1ObjectIdentifier("2.5.4.10");
     public static final ASN1ObjectIdentifier ou = new ASN1ObjectIdentifier("2.5.4.11");
     public static final ASN1ObjectIdentifier owner = new ASN1ObjectIdentifier("2.5.4.32");
     public static final ASN1ObjectIdentifier physicalDeliveryOfficeName = new ASN1ObjectIdentifier("2.5.4.19");
     public static final ASN1ObjectIdentifier postalAddress = new ASN1ObjectIdentifier("2.5.4.16");
     public static final ASN1ObjectIdentifier postalCode = new ASN1ObjectIdentifier("2.5.4.17");
     public static final ASN1ObjectIdentifier postOfficeBox = new ASN1ObjectIdentifier("2.5.4.18");
     public static final ASN1ObjectIdentifier preferredDeliveryMethod = new ASN1ObjectIdentifier("2.5.4.28");
     public static final ASN1ObjectIdentifier registeredAddress = new ASN1ObjectIdentifier("2.5.4.26");
     public static final ASN1ObjectIdentifier roleOccupant = new ASN1ObjectIdentifier("2.5.4.33");
     public static final ASN1ObjectIdentifier searchGuide = new ASN1ObjectIdentifier("2.5.4.14");
     public static final ASN1ObjectIdentifier seeAlso = new ASN1ObjectIdentifier("2.5.4.34");
     public static final ASN1ObjectIdentifier serialNumber = new ASN1ObjectIdentifier("2.5.4.5");
     public static final ASN1ObjectIdentifier sn = new ASN1ObjectIdentifier("2.5.4.4");
     public static final ASN1ObjectIdentifier st = new ASN1ObjectIdentifier("2.5.4.8");
     public static final ASN1ObjectIdentifier street = new ASN1ObjectIdentifier("2.5.4.9");
     public static final ASN1ObjectIdentifier telephoneNumber = new ASN1ObjectIdentifier("2.5.4.20");
     public static final ASN1ObjectIdentifier teletexTerminalIdentifier = new ASN1ObjectIdentifier("2.5.4.22");
     public static final ASN1ObjectIdentifier telexNumber = new ASN1ObjectIdentifier("2.5.4.21");
     public static final ASN1ObjectIdentifier title = new ASN1ObjectIdentifier("2.5.4.12");
     public static final ASN1ObjectIdentifier uid = new ASN1ObjectIdentifier("0.9.2342.19200300.100.1.1");
     public static final ASN1ObjectIdentifier uniqueMember = new ASN1ObjectIdentifier("2.5.4.50");
     public static final ASN1ObjectIdentifier userPassword = new ASN1ObjectIdentifier("2.5.4.35");
     public static final ASN1ObjectIdentifier x121Address = new ASN1ObjectIdentifier("2.5.4.24");
     public static final ASN1ObjectIdentifier x500UniqueIdentifier = new ASN1ObjectIdentifier("2.5.4.45");

    
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("businessCategory");
         .put("c");
         .put("cn");
         .put("dc");
         .put("description");
         .put("destinationIndicator");
         .put("distinguishedName");
         .put("dnQualifier");
         .put("enhancedSearchGuide");
         .put("facsimileTelephoneNumber");
         .put("generationQualifier");
         .put("givenName");
         .put("houseIdentifier");
         .put("initials");
         .put("internationalISDNNumber");
         .put("l");
         .put("member");
         .put("name");
         .put("o");
         .put("ou");
         .put("owner");
         .put("physicalDeliveryOfficeName");
         .put("postalAddress");
         .put("postalCode");
         .put("postOfficeBox");
         .put("preferredDeliveryMethod");
         .put("registeredAddress");
        .put("roleOccupant");
        .put("searchGuide");
        .put("seeAlso");
        .put("serialNumber");
        .put("sn");
        .put("st");
        .put("street");
        .put("telephoneNumber");
        .put("teletexTerminalIdentifier");
        .put("telexNumber");
        .put("title");
        .put("uid");
        .put("uniqueMember");
        .put("userPassword");
        .put("x121Address");
        .put("x500UniqueIdentifier");
        .put("businesscategory");
        .put("c");
        .put("cn");
        .put("dc");
        .put("description");
        .put("destinationindicator");
        .put("distinguishedname");
        .put("dnqualifier");
        .put("enhancedsearchguide");
        .put("facsimiletelephonenumber");
        .put("generationqualifier");
        .put("givenname");
        .put("houseidentifier");
        .put("initials");
        .put("internationalisdnnumber");
        .put("l");
        .put("member");
        .put("name");
        .put("o");
        .put("ou");
        .put("owner");
        .put("physicaldeliveryofficename");
        .put("postaladdress");
        .put("postalcode");
        .put("postofficebox");
        .put("preferreddeliverymethod");
        .put("registeredaddress");
        .put("roleoccupant");
        .put("searchguide");
        .put("seealso");
        .put("serialnumber");
        .put("sn");
        .put("st");
        .put("street");
        .put("telephonenumber");
        .put("teletexterminalidentifier");
        .put("telexnumber");
        .put("title");
        .put("uid");
        .put("uniquemember");
        .put("userpassword");
        .put("x121address");
        .put("x500uniqueidentifier");
        // TODO: need to add correct matching for equality comparisons.
    }

    
Singleton instance.
    public static final X500NameStyle INSTANCE = new RFC4519Style();
    protected final Hashtable defaultLookUp;
    protected final Hashtable defaultSymbols;
    protected RFC4519Style()
    {
    }
    		String value) {
    	if (oid.equals())
        {
            return new DERIA5String(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);
    }
    // parse backwards
    public RDN[] fromString(String dirName)
    {
        RDN[] tmp = IETFUtils.rDNsFromString(dirNamethis);
        RDN[] res = new RDN[tmp.length];
        for (int i = 0; i != tmp.lengthi++)
        {
            res[res.length - i - 1] = tmp[i];
        }
        return res;
    }
    // convert in reverse
    public String toString(X500Name name)
    {
        StringBuffer buf = new StringBuffer();
        boolean first = true;
        RDN[] rdns = name.getRDNs();
        for (int i = rdns.length - 1; i >= 0; i--)
        {
            if (first)
            {
                first = false;
            }
            else
            {
                buf.append(',');
            }
            IETFUtils.appendRDN(bufrdns[i], );
        }
        return buf.toString();
    }
    
New to GrepCode? Check out our FAQ X