Udostępnij za pośrednictwem


X500Principal.GetName Method

Definition

Overloads

GetName(String)

Returns a string representation of the X.

GetName(String, IDictionary<String,String>)

Returns a string representation of the X.

GetName(String)

Returns a string representation of the X.

[Android.Runtime.Register("getName", "(Ljava/lang/String;)Ljava/lang/String;", "")]
public string? GetName (string? format);
[<Android.Runtime.Register("getName", "(Ljava/lang/String;)Ljava/lang/String;", "")>]
member this.GetName : string -> string

Parameters

format
String

the format to use

Returns

a string representation of this X500Principal using the specified format

Attributes

Exceptions

if the format argument is not one of the three mentioned above

Remarks

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:

<ol> <li> Leading zeros are removed from attribute types that are encoded as dotted decimal OIDs <li> DirectoryString attribute values of type PrintableString and UTF8String are not output in hexadecimal format <li> DirectoryString attribute values of types other than PrintableString and UTF8String are output in hexadecimal format <li> Leading and trailing white space characters are removed from non-hexadecimal attribute values (unless the value consists entirely of white space characters) <li> Internal substrings of one or more white space characters are converted to a single space in non-hexadecimal attribute values <li> 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. <li> 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) <li> The entire name is converted to upper case using String.toUpperCase(Locale.US)<li> The entire name is converted to lower case using String.toLowerCase(Locale.US)<li> The name is finally normalized using normalization form KD, as described in the Unicode Standard and UAX #15 </ol>

Additional standard formats may be introduced in the future.

Java documentation for javax.security.auth.x500.X500Principal.getName(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

GetName(String, IDictionary<String,String>)

Returns a string representation of the X.

[Android.Runtime.Register("getName", "(Ljava/lang/String;Ljava/util/Map;)Ljava/lang/String;", "")]
public string? GetName (string? format, System.Collections.Generic.IDictionary<string,string>? oidMap);
[<Android.Runtime.Register("getName", "(Ljava/lang/String;Ljava/util/Map;)Ljava/lang/String;", "")>]
member this.GetName : string * System.Collections.Generic.IDictionary<string, string> -> string

Parameters

format
String

the format to use

oidMap
IDictionary<String,String>

an OID map, where each key is an object identifier in String form (a sequence of nonnegative integers separated by periods) that maps to a corresponding attribute type keyword String. The map may be empty but never null.

Returns

a string representation of this X500Principal using the specified format

Attributes

Remarks

Returns a string representation of the X.500 distinguished name using the specified format. Valid values for the format are "RFC1779" and "RFC2253" (case insensitive). "CANONICAL" is not permitted and an IllegalArgumentException will be thrown.

This method returns Strings in the format as specified in #getName(String) and also emits additional attribute type keywords for OIDs that have entries in the oidMap parameter. OID entries in the oidMap take precedence over the default OIDs recognized by getName(String). Improperly specified OIDs are ignored; however if an OID in the name maps to an improperly specified keyword, an IllegalArgumentException is thrown.

Additional standard formats may be introduced in the future.

Warning: additional attribute type keywords may not be recognized by other implementations; therefore do not use this method if you are unsure if these keywords will be recognized by other implementations.

Added in 1.6.

Java documentation for javax.security.auth.x500.X500Principal.getName(java.lang.String, java.util.Map<java.lang.String, java.lang.String>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to