| Modifier and Type | Method and Description |
|---|---|
static String |
getAlpnSelectedProtocol(SSLSocket socket)
Returns the ALPN protocol agreed upon by client and server.
|
static byte[] |
getChannelId(SSLSocket socket)
Gets the TLS Channel ID for the given server-side socket.
|
static String |
getHostname(SSLSocket socket)
Returns either the hostname supplied during socket creation or via
Conscrypt.Sockets.setHostname(SSLSocket, String). |
static String |
getHostnameOrIP(SSLSocket socket)
This method attempts to create a textual representation of the peer host or IP.
|
static boolean |
isConscrypt(SSLSocket socket)
Indicates whether the given socket is a Conscrypt socket.
|
static void |
setAlpnProtocols(SSLSocket socket,
String[] alpnProtocols)
Sets the list of ALPN protocols supported by the socket.
|
static void |
setChannelIdEnabled(SSLSocket socket,
boolean enabled)
Enables/disables TLS Channel ID for the given server-side socket.
|
static void |
setChannelIdPrivateKey(SSLSocket socket,
PrivateKey privateKey)
Sets the
PrivateKey to be used for TLS Channel ID by this client socket. |
static void |
setHostname(SSLSocket socket,
String hostname)
This method enables Server Name Indication (SNI) and overrides the hostname supplied
during socket creation.
|
static void |
setUseSessionTickets(SSLSocket socket,
boolean useSessionTickets)
This method enables session ticket support.
|
public static boolean isConscrypt(SSLSocket socket)
public static void setHostname(SSLSocket socket, String hostname)
socket - the sockethostname - the desired SNI hostname, or null to disablepublic static String getHostname(SSLSocket socket)
Conscrypt.Sockets.setHostname(SSLSocket, String). No DNS resolution is attempted before
returning the hostname.public static String getHostnameOrIP(SSLSocket socket)
public static void setUseSessionTickets(SSLSocket socket, boolean useSessionTickets)
socket - the socketuseSessionTickets - True to enable session ticketspublic static void setChannelIdEnabled(SSLSocket socket, boolean enabled)
This method needs to be invoked before the handshake starts.
socket - the socketenabled - Whether to enable channel ID.IllegalStateException - if this is a client socket or if the handshake has already
started.public static byte[] getChannelId(SSLSocket socket) throws SSLException
socket - the socketnull if not available.IllegalStateException - if this is a client socket or if the handshake has not yet
completed.SSLException - if channel ID is available but could not be obtained.public static void setChannelIdPrivateKey(SSLSocket socket, PrivateKey privateKey)
PrivateKey to be used for TLS Channel ID by this client socket.
This method needs to be invoked before the handshake starts.
socket - the socketprivateKey - private key (enables TLS Channel ID) or null for no key
(disables TLS Channel ID).
The private key must be an Elliptic Curve (EC) key based on the NIST P-256 curve (aka
SECG secp256r1 or ANSI
X9.62 prime256v1).IllegalStateException - if this is a server socket or if the handshake has already
started.public static String getAlpnSelectedProtocol(SSLSocket socket)
socket - the socketnull if no protocol was agreed upon.