Class RDNSequence

java.lang.Object
org.cryptacular.x509.dn.RDNSequence
All Implemented Interfaces:
Iterable<RDN>

public class RDNSequence extends Object implements Iterable<RDN>
Simple implementation of the X.501 RDNSequence type described in section 4.1.2.4 of RFC 2459.
Author:
Middleware Services
  • Constructor Details

    • RDNSequence

      public RDNSequence()
  • Method Details

    • add

      public void add(RDN rdn)
      Adds an RDN to the sequence.
      Parameters:
      rdn - RDN to add.
    • iterator

      public Iterator<RDN> iterator()
      Specified by:
      iterator in interface Iterable<RDN>
    • backward

      public Iterable<RDN> backward()
      Returns:
      Iterable that moves backward over the RDN sequence.
    • getValues

      public List<String> getValues(AttributeType type)
      Gets an immutable list of all attributes of the given type. The order of the returned list reflects the ordering of the RDNs and their attributes.
      Parameters:
      type - Attribute type.
      Returns:
      Non-null list of attributes of given type. An empty list is returned if there are no attributes of the given type.
    • getValue

      public String getValue(AttributeType type)
      Gets the first value of the given type that appears in the attribute list of any RDN in the sequence.
      Parameters:
      type - Attribute type.
      Returns:
      Value of first attribute of given type or null if no attributes of given type exist.
    • toString

      public String toString()
      Creates a comma-separated list of TYPE=VALUE tokens from the attributes in the list in order.
      Overrides:
      toString in class Object
      Returns:
      String representation that resembles an X.509 distinguished name, e.g. CN=foo, OU=Bar, dc=example, dc=com.