Returns a string representation of the X.500 distinguished name
using the specified format. Valid values for the format are
"RFC1779", "RFC2253", and "CANONICAL" (case insensitive).
If "RFC1779" is specified as the format,
this method emits the attribute type keywords defined in
RFC 1779 (CN, L, ST, O, OU, C, STREET).
Any other attribute type is emitted as an OID.
If "RFC2253" is specified as the format,
this method emits the attribute type keywords defined in
RFC 2253 (CN, L, ST, O, OU, C, STREET, DC, UID).
Any other attribute type is emitted as an OID.
Under a strict reading, RFC 2253 only specifies a UTF-8 string
representation. The String returned by this method is the
Unicode string achieved by decoding this UTF-8 representation.
If "CANONICAL" is specified as the format,
this method returns an RFC 2253 conformant string representation
with the following additional canonicalizations:
- Leading zeros are removed from attribute types
that are encoded as dotted decimal OIDs
- DirectoryString attribute values of type
PrintableString and UTF8String are not
output in hexadecimal format
- DirectoryString attribute values of types
other than PrintableString and UTF8String
are output in hexadecimal format
- Leading and trailing white space characters
are removed from non-hexadecimal attribute values
(unless the value consists entirely of white space characters)
- Internal substrings of one or more white space characters are
converted to a single space in non-hexadecimal
attribute values
- Relative Distinguished Names containing more than one
Attribute Value Assertion (AVA) are output in the
following order: an alphabetical ordering of AVAs
containing standard keywords, followed by a numeric
ordering of AVAs containing OID keywords.
- The only characters in attribute values that are escaped are
those which section 2.4 of RFC 2253 states must be escaped
(they are escaped using a preceding backslash character)
- The entire name is converted to upper case
using
String.toUpperCase(Locale.US)
- The entire name is converted to lower case
using
String.toLowerCase(Locale.US)
- The name is finally normalized using normalization form KD,
as described in the Unicode Standard and UAX #15
Additional standard formats may be introduced in the future.
Returns:
a string representation of this X500Principal
using the specified format
Parameters:
- format - the format to use
Throws:
- IllegalArgumentException - if the specified format is invalid
or null