Class AbstractX500NameStyle

java.lang.Object
org.bouncycastle.asn1.x500.style.AbstractX500NameStyle
All Implemented Interfaces:
X500NameStyle
Direct Known Subclasses:
BCStyle, RFC4519Style

public abstract class AbstractX500NameStyle extends Object implements X500NameStyle
This class provides some default behavior and common implementation for a X500NameStyle. It should be easily extendable to support implementing the desired X500NameStyle.
  • Constructor Details

    • AbstractX500NameStyle

      public AbstractX500NameStyle()
  • Method Details

    • copyHashTable

      public static Hashtable copyHashTable(Hashtable paramsMap)
      Tool function to shallow copy a Hashtable.
      Parameters:
      paramsMap - table to copy
      Returns:
      the copy of the table
    • calculateHashCode

      public int calculateHashCode(X500Name name)
      Description copied from interface: X500NameStyle
      Calculate a hashCode for the passed in name.
      Specified by:
      calculateHashCode in interface X500NameStyle
      Parameters:
      name - the name the hashCode is required for.
      Returns:
      the calculated hashCode.
    • stringToValue

      public ASN1Encodable stringToValue(ASN1ObjectIdentifier oid, String value)
      For all string values starting with '#' is assumed, that these are already valid ASN.1 objects encoded in hex.

      All other string values are send to encodeStringValue(ASN1ObjectIdentifier, String).

      Subclasses should overwrite encodeStringValue(ASN1ObjectIdentifier, String) to change the encoding of specific types.
      Specified by:
      stringToValue in interface X500NameStyle
      Parameters:
      oid - the DN name of the value.
      value - the String representation of the value.
      Returns:
      the ASN.1 equivalent for the value.
    • encodeStringValue

      protected ASN1Encodable encodeStringValue(ASN1ObjectIdentifier oid, String value)
      Encoded every value into a UTF8String.

      Subclasses should overwrite this method to change the encoding of specific types.

      Parameters:
      oid - the DN oid of the value
      value - the String representation of the value
      Returns:
      a the value encoded into a ASN.1 object. Never returns null.
    • areEqual

      public boolean areEqual(X500Name name1, X500Name name2)
      Description copied from interface: X500NameStyle
      Return true if the two names are equal.
      Specified by:
      areEqual in interface X500NameStyle
      Parameters:
      name1 - first name for comparison.
      name2 - second name for comparison.
      Returns:
      true if name1 = name 2, false otherwise.
    • rdnAreEqual

      protected boolean rdnAreEqual(RDN rdn1, RDN rdn2)