Class Name

  • All Implemented Interfaces:
    ASN1Value

    public class Name
    extends java.lang.Object
    implements ASN1Value
    An X.500 Name.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Name.Template  
    • Constructor Summary

      Constructors 
      Constructor Description
      Name()
      Creates an empty Name.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addCommonName​(java.lang.String CN)
      Adds a common name (CN) to the Name.
      void addCountryName​(java.lang.String C)
      Adds a country name (C) to the Name.
      void addElement​(AVA ava)
      Adds a relative distinguished name containing a single AVA.
      void addElement​(RDN name)
      Adds a relative distinguished name to the Name.
      void addLocalityName​(java.lang.String L)
      Adds a locality name (L) to the Name.
      void addOrganizationalUnitName​(java.lang.String OU)
      Adds an organizational unit name (OU) to the Name.
      void addOrganizationName​(java.lang.String O)
      Adds an organization name (O) to the Name.
      void addStateOrProvinceName​(java.lang.String S)
      Adds a state or province name (S) to the Name.
      RDN elementAt​(int idx)
      Returns the RDN at the given index in the Name.
      void encode​(java.io.OutputStream ostream)
      Write this value's DER encoding to an output stream using its own base tag.
      void encode​(Tag implicit, java.io.OutputStream ostream)
      Write this value's DER encoding to an output stream using an implicit tag.
      java.lang.String getRFC1485()  
      Tag getTag()
      Returns the base tag for this type, not counting any tags that may be imposed on it by its context.
      static Name.Template getTemplate()  
      void insertElementAt​(RDN name, int idx)
      Inserts the given RDN at the given index in the Name.
      static void main​(java.lang.String[] args)  
      void removeElementAt​(int idx)
      Removes the Name element at the given index.
      int size()
      Returns the number of RDNs in the Name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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.
    • Constructor Detail

      • Name

        public Name()
        Creates an empty Name.
    • Method Detail

      • 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​(java.io.OutputStream ostream)
                    throws java.io.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:
        java.io.IOException - If an error occurred.
      • encode

        public void encode​(Tag implicit,
                           java.io.OutputStream ostream)
                    throws java.io.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:
        java.io.IOException - If an error occurred.
      • addCommonName

        public void addCommonName​(java.lang.String CN)
                           throws java.io.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:
        java.io.CharConversionException
      • addCountryName

        public void addCountryName​(java.lang.String C)
                            throws java.io.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:
        java.lang.IllegalArgumentException - If C.length() != 2.
        java.io.CharConversionException
      • addLocalityName

        public void addLocalityName​(java.lang.String L)
                             throws java.io.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:
        java.io.CharConversionException
      • addStateOrProvinceName

        public void addStateOrProvinceName​(java.lang.String S)
                                    throws java.io.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:
        java.io.CharConversionException
      • addOrganizationName

        public void addOrganizationName​(java.lang.String O)
                                 throws java.io.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:
        java.io.CharConversionException
      • addOrganizationalUnitName

        public void addOrganizationalUnitName​(java.lang.String OU)
                                       throws java.io.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:
        java.io.CharConversionException
      • main

        public static void main​(java.lang.String[] args)