Class X500Principal

    • Constructor Detail

      • X500Principal

        public X500Principal​(byte[] name)
        Creates an X500Principal from a distinguished name in ASN.1 DER encoded form. The ASN.1 notation for this structure is as follows.
         
         Name ::= CHOICE {
           RDNSequence }
        
         RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
        
         RelativeDistinguishedName ::=
           SET SIZE (1 .. MAX) OF AttributeTypeAndValue
        
         AttributeTypeAndValue ::= SEQUENCE {
           type     AttributeType,
           value    AttributeValue }
        
         AttributeType ::= OBJECT IDENTIFIER
        
         AttributeValue ::= ANY DEFINED BY AttributeType
         ....
         DirectoryString ::= CHOICE {
               teletexString           TeletexString (SIZE (1..MAX)),
               printableString         PrintableString (SIZE (1..MAX)),
               universalString         UniversalString (SIZE (1..MAX)),
               utf8String              UTF8String (SIZE (1.. MAX)),
               bmpString               BMPString (SIZE (1..MAX)) }
         
         
        Parameters:
        name - a byte array containing the distinguished name in ASN.1 DER encoded form
        Throws:
        IllegalArgumentException - if an encoding error occurs (incorrect form for DN)
      • X500Principal

        public X500Principal​(InputStream is)
        Creates an X500Principal from an InputStream containing the distinguished name in ASN.1 DER encoded form. The ASN.1 notation for this structure is supplied in the documentation for X500Principal(byte[] name).

        The read position of the input stream is positioned to the next available byte after the encoded distinguished name.

        Parameters:
        is - an InputStream containing the distinguished name in ASN.1 DER encoded form
        Throws:
        NullPointerException - if the InputStream is null
        IllegalArgumentException - if an encoding error occurs (incorrect form for DN)
    • Method Detail

      • getName

        public String getName()
        Returns a string representation of the X.500 distinguished name.

        The chosen format is a '#' character followed by the hexadecimal encoding of de DER representation of the name. (No spaces between digits, letters in lower case).

        Returns:
        the distinguished name of this X500Principal
      • equals

        public boolean equals​(@Nullable
                              Object o)
        Compares the specified Object with this X500Principal for equality.

        Specifically, this method returns true if the Object o is an X500Principal and if the respective canonical string representations (obtained via the getName(X500Principal.CANONICAL) method) of this object and o are equal.

        This implementation is compliant with the requirements of RFC 3280.

        Specified by:
        equals in interface Principal
        Overrides:
        equals in class Object
        Parameters:
        o - Object to be compared for equality with this X500Principal
        Returns:
        true if the specified Object is equal to this X500Principal, false otherwise
        See Also:
        Object.hashCode(), HashMap