Udostępnij za pośrednictwem


SNIHostName Constructors

Definition

Overloads

SNIHostName(Byte[])

Creates an SNIHostName using the specified encoded value.

SNIHostName(String)

Creates an SNIHostName using the specified hostname.

SNIHostName(Byte[])

Creates an SNIHostName using the specified encoded value.

[Android.Runtime.Register(".ctor", "([B)V", "", ApiSince=24)]
public SNIHostName (byte[]? encoded);
[<Android.Runtime.Register(".ctor", "([B)V", "", ApiSince=24)>]
new Javax.Net.Ssl.SNIHostName : byte[] -> Javax.Net.Ssl.SNIHostName

Parameters

encoded
Byte[]

the encoded hostname of this server name

Attributes

Remarks

Creates an SNIHostName using the specified encoded value.

This method is normally used to parse the encoded name value in a requested SNI extension.

Per RFC 6066, the encoded name value of a hostname is StandardCharsets#US_ASCII-compliant. However, in the previous version of the SNI extension ( RFC 4366), the encoded hostname is represented as a byte string using UTF-8 encoding. For the purpose of version tolerance, this method allows that the charset of encoded argument can be StandardCharsets#UTF_8, as well as StandardCharsets#US_ASCII. IDN#toASCII(String) is used to translate the encoded argument into ASCII Compatible Encoding (ACE) hostname.

It is strongly recommended that this constructor is only used to parse the encoded name value in a requested SNI extension. Otherwise, to comply with RFC 6066, please always use StandardCharsets#US_ASCII-compliant charset and enforce the restrictions on ASCII characters in hostnames (see RFC 3490, RFC 1122, RFC 1123) for encoded argument, or use SNIHostName#SNIHostName(String) instead.

The encoded argument is illegal if it: <ul> <li> encoded is empty,</li> <li> encoded ends with a trailing dot,</li> <li> encoded is not encoded in StandardCharsets#US_ASCII or StandardCharsets#UTF_8-compliant charset,</li> <li> encoded is not a valid Internationalized Domain Name (IDN) compliant with the RFC 3490 specification.</li> </ul>

Note that the encoded byte array is cloned to protect against subsequent modification.

Java documentation for javax.net.ssl.SNIHostName.SNIHostName(byte[]).

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

SNIHostName(String)

Creates an SNIHostName using the specified hostname.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "", ApiSince=24)]
public SNIHostName (string? hostname);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "", ApiSince=24)>]
new Javax.Net.Ssl.SNIHostName : string -> Javax.Net.Ssl.SNIHostName

Parameters

hostname
String

the hostname of this server name

Attributes

Remarks

Creates an SNIHostName using the specified hostname.

Note that per RFC 6066, the encoded server name value of a hostname is StandardCharsets#US_ASCII-compliant. In this method, hostname can be a user-friendly Internationalized Domain Name (IDN). IDN#toASCII(String, int) is used to enforce the restrictions on ASCII characters in hostnames (see RFC 3490, RFC 1122, RFC 1123) and translate the hostname into ASCII Compatible Encoding (ACE), as:

IDN.toASCII(hostname, IDN.USE_STD3_ASCII_RULES);

The hostname argument is illegal if it: <ul> <li> hostname is empty,</li> <li> hostname ends with a trailing dot,</li> <li> hostname is not a valid Internationalized Domain Name (IDN) compliant with the RFC 3490 specification.</li> </ul>

Java documentation for javax.net.ssl.SNIHostName.SNIHostName(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