Package org.cryptacular.x509.dn
Class LdapNameFormatter
java.lang.Object
org.cryptacular.x509.dn.LdapNameFormatter
- All Implemented Interfaces:
NameFormatter
Produces a string representation of an X.500 distinguished name using the process described in section 2 of RFC 2253,
LADPv3 Distinguished Names.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charSeparator character between ATV components in the same RDN element.private static final HexEncoderHandles hex encoding.static final charEscape character.static final charSeparator character between RDN components.static final StringString of characters that need to be escaped. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidencode(String value, StringBuilder output) Appends the given value to the output using the HEX encoding method described in section 2.4.private static voidescape(String value, StringBuilder output) Appends the given value to the output with proper character escaping.format(X500Principal dn) Produces a string representation of the given X.500 principal.
-
Field Details
-
RDN_SEPARATOR
public static final char RDN_SEPARATORSeparator character between RDN components.- See Also:
-
ATV_SEPARATOR
public static final char ATV_SEPARATORSeparator character between ATV components in the same RDN element.- See Also:
-
ESCAPE_CHAR
public static final char ESCAPE_CHAREscape character.- See Also:
-
RESERVED_CHARS
String of characters that need to be escaped.- See Also:
-
ENCODER
Handles hex encoding.
-
-
Constructor Details
-
LdapNameFormatter
public LdapNameFormatter()
-
-
Method Details
-
format
Description copied from interface:NameFormatterProduces a string representation of the given X.500 principal.- Specified by:
formatin interfaceNameFormatter- Parameters:
dn- Distinguished name as an X.500 principal.- Returns:
- String representation of DN.
-
escape
Appends the given value to the output with proper character escaping.- Parameters:
value- Value to escape.output- String builder where escaped value is written.
-
encode
Appends the given value to the output using the HEX encoding method described in section 2.4.- Parameters:
value- Value to encode.output- String builder where encoded value is written.
-