java.lang.Object
org.mozilla.jss.netscape.security.x509.RDN

public class RDN extends Object
RDNs are a set of {attribute = value} assertions. Some of those attributes are "distinguished" (unique w/in context). Order is never relevant. Some X.500 names include only a single distinguished attribute per RDN. This style is currently common. Note that DER-encoded RDNs sort AVAs by assertion OID ... so that when we parse this data we don't have to worry about canonicalizing it, but we'll need to sort them when we expose the RDN class more.
See Also:
  • Field Details

    • assertion

      private AVA[] assertion
  • Constructor Details

    • RDN

      public RDN(String rdnString) throws IOException
      Constructs a RDN from a Ldap DN String with one RDN component using the global default LdapDNStrConverter.
      Parameters:
      rdnString - a Ldap DN string with one RDN component, e.g. as defined in RFC1779.
      Throws:
      IOException - if error occurs while parsing the string.
      See Also:
    • RDN

      public RDN(String rdnString, byte[] tags) throws IOException
      Like RDN(String) with a DER encoding order given as argument for Directory Strings.
      Throws:
      IOException
    • RDN

      public RDN(String rdnString, LdapDNStrConverter ldapDNStrConverter) throws IOException
      Constructs a RDN from a Ldap DN string with one RDN component using the specified Ldap DN Str converter. For example, RFC1779StrConverter can be passed to parse a Ldap DN string in RFC1779 format.
      Parameters:
      rdnString - Ldap DN string.
      ldapDNStrConverter - a LdapDNStrConverter.
      Throws:
      IOException
      See Also:
    • RDN

      public RDN(DerValue set) throws IOException
      Constructs a RDN from a DerValue.
      Parameters:
      set - Der value of a set of AVAs.
      Throws:
      IOException
    • RDN

      public RDN(DerInputStream in) throws IOException
      Constructs a RDN from a Der Input Stream.
      Parameters:
      in - a Der Input Stream.
      Throws:
      IOException
    • RDN

      public RDN(AVA[] avas)
      Constructs a RDN from an array of AVA.
      Parameters:
      avas - a AVA Array.
    • RDN

      public RDN(Vector<AVA> avaVector)
      convenience method.
  • Method Details

    • getAssertion

      public AVA[] getAssertion()
      returns an array of AVA in the RDN.
      Returns:
      array of AVA in this RDN.
    • getAssertionLength

      public int getAssertionLength()
      returns the number of AVAs in the RDN.
      Returns:
      number of AVAs in this RDN.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • findAttribute

      DerValue findAttribute(ObjectIdentifier oid)
    • encode

      public void encode(DerOutputStream out) throws IOException
      Encodes this RDN to a Der output stream.
      Parameters:
      out - the Der Output Stream.
      Throws:
      IOException
    • getAVAs

      public Enumeration<AVA> getAVAs()
      returns an enumeration of AVAs that make up this RDN.
      Returns:
      an enumeration of AVAs that make up this RDN.
    • toLdapDNString

      public String toLdapDNString() throws IOException
      Returns a Ldap DN string with one RDN component using the global default LdapDNStrConverter.
      Returns:
      the Ldap DN String of this RDN.
      Throws:
      IOException - if an error occurs during the conversion.
      See Also:
    • toLdapDNString

      public String toLdapDNString(LdapDNStrConverter ldapDNStrConverter) throws IOException
      Returns a Ldap DN String with this RDN component using the specified LdapDNStrConverter.
      Parameters:
      ldapDNStrConverter - a LdapDNStrConverter.
      Returns:
      a Ldap DN String.
      Throws:
      IOException - if an error occurs in the conversion.
      See Also:
    • toString

      public String toString()
      Returns a Ldap DN string with this RDN component using the global default LdapDNStrConverter.
      Overrides:
      toString in class Object
      Returns:
      the Ldap DN String with this RDN component, null if an error occurs in the conversion.
      See Also: