Class Name

java.lang.Object
org.mozilla.jss.pkix.primitive.Name
All Implemented Interfaces:
ASN1Value

public class Name extends Object implements ASN1Value
An X.500 Name.
  • Field Details

    • rdns

      SEQUENCE rdns
    • TAG

      public static final Tag TAG
    • commonName

      public static final OBJECT_IDENTIFIER commonName
      The OID for the common name (CN) attribute.
    • countryName

      public static final OBJECT_IDENTIFIER countryName
      The OID for the country name (C) attribute.
    • localityName

      public static final OBJECT_IDENTIFIER localityName
      The OID for the locality name (L) attribute.
    • stateOrProvinceName

      public static final OBJECT_IDENTIFIER stateOrProvinceName
      The OID for the state or province name (S) attribute.
    • organizationName

      public static final OBJECT_IDENTIFIER organizationName
      The OID for the organization name (O) attribute.
    • organizationalUnitName

      public static final OBJECT_IDENTIFIER organizationalUnitName
      The OID for the organizational unit name (OU) attribute.
    • templateInstance

      private static final Name.Template templateInstance
  • Constructor Details

    • Name

      public Name()
      Creates an empty Name.
    • Name

      Name(SEQUENCE rdns)
      Creates a name from a sequence of relative distinguished names.
  • Method Details

    • addElement

      public void addElement(RDN name)
      Adds a relative distinguished name to the Name.
      Parameters:
      name - A relative distinguished name (RDN) to be added to the Name.
    • addElement

      public void addElement(AVA ava)
      Adds a relative distinguished name containing a single AVA.
      Parameters:
      ava - An AttributeValueAssertion, which will be inserted as the sole element of a new RDN, which will be stored in the Name.
    • insertElementAt

      public void insertElementAt(RDN name, int idx)
      Inserts the given RDN at the given index in the Name.
    • elementAt

      public RDN elementAt(int idx)
      Returns the RDN at the given index in the Name.
    • removeElementAt

      public void removeElementAt(int idx)
      Removes the Name element at the given index.
    • size

      public int size()
      Returns the number of RDNs in the Name.
    • getTag

      public Tag getTag()
      Description copied from interface: ASN1Value
      Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
      Specified by:
      getTag in interface ASN1Value
      Returns:
      Base tag.
    • encode

      public void encode(OutputStream ostream) throws IOException
      Description copied from interface: ASN1Value
      Write this value's DER encoding to an output stream using its own base tag.
      Specified by:
      encode in interface ASN1Value
      Parameters:
      ostream - Output stream.
      Throws:
      IOException - If an error occurred.
    • encode

      public void encode(Tag implicit, OutputStream ostream) throws IOException
      Description copied from interface: ASN1Value
      Write this value's DER encoding to an output stream using an implicit tag.
      Specified by:
      encode in interface ASN1Value
      Parameters:
      implicit - Implicit tag.
      ostream - Output stream.
      Throws:
      IOException - If an error occurred.
    • addCommonName

      public void addCommonName(String CN) throws CharConversionException
      Adds a common name (CN) to the Name.
      Parameters:
      CN - The common name. It will be formatted according to the IETF PKIX rules for directory strings.
      Throws:
      CharConversionException
    • addCountryName

      public void addCountryName(String C) throws CharConversionException
      Adds a country name (C) to the Name. It must be exactly two characters.
      Parameters:
      C - The country name. It will be formatted according to the IETF PKIX rules for directory strings.
      Throws:
      IllegalArgumentException - If C.length() != 2.
      CharConversionException
    • addLocalityName

      public void addLocalityName(String L) throws CharConversionException
      Adds a locality name (L) to the Name.
      Parameters:
      L - The locality name. It will be formatted according to the IETF PKIX rules for directory strings.
      Throws:
      CharConversionException
    • addStateOrProvinceName

      public void addStateOrProvinceName(String S) throws CharConversionException
      Adds a state or province name (S) to the Name.
      Parameters:
      S - The state or province name. It will be formatted according to the IETF PKIX rules for directory strings.
      Throws:
      CharConversionException
    • addOrganizationName

      public void addOrganizationName(String O) throws CharConversionException
      Adds an organization name (O) to the Name.
      Parameters:
      O - The organization name. It will be formatted according to the IETF PKIX rules for directory strings.
      Throws:
      CharConversionException
    • addOrganizationalUnitName

      public void addOrganizationalUnitName(String OU) throws CharConversionException
      Adds an organizational unit name (OU) to the Name.
      Parameters:
      OU - The organizational unit name. It will be formatted according to the IETF PKIX rules for directory strings.
      Throws:
      CharConversionException
    • typeToString

      private String typeToString(OBJECT_IDENTIFIER type)
    • AVAToString

      private String AVAToString(AVA ava) throws InvalidBERException
      Throws:
      InvalidBERException
    • getRFC1485

      public String getRFC1485() throws InvalidBERException
      Throws:
      InvalidBERException
    • getTemplate

      public static Name.Template getTemplate()
    • main

      public static void main(String[] args)