Class DefaultDnParser

  • All Implemented Interfaces:
    DnParser

    public final class DefaultDnParser
    extends Object
    implements DnParser
    Parses DNs following the rules in RFC 4514. Attempts to be as generous as possible in the format of allowed DNs.
    • Field Detail

      • HEX_PATH

        private static final DERPath HEX_PATH
        DER path for hex values.
    • Constructor Detail

      • DefaultDnParser

        public DefaultDnParser()
    • Method Detail

      • parse

        public List<RDn> parse​(String dn)
        Parses the supplied DN into a list of RDNs.
        Specified by:
        parse in interface DnParser
        Parameters:
        dn - to parse
        Returns:
        unmodifiable list of RDNs
      • decodeHexValue

        private static byte[] decodeHexValue​(char[] value)
        Decodes the supplied hexadecimal value.
        Parameters:
        value - hex to decode
        Returns:
        decoded bytes
      • decodeStringValue

        private static String decodeStringValue​(String value)
        Decodes the supplied string attribute value. Unescapes escaped characters. If escaped character is a hex value, it is decoded.
        Parameters:
        value - to decode
        Returns:
        decoded string
      • readToChar

        private static int[] readToChar​(String s,
                                        char[] chars,
                                        int pos)
        Reads the supplied string starting at the supplied position until one of the supplied characters is found. Characters escaped with '\' are ignored. Characters inside of quotes are ignored.
        Parameters:
        s - to read
        chars - to match
        pos - to start reading at
        Returns:
        string index that matched a character or the last index in the string