| Modifier and Type | Method and Description |
|---|---|
static String |
getAlpnSelectedProtocol(SSLEngine engine)
Returns the ALPN protocol agreed upon by client and server.
|
static byte[] |
getChannelId(SSLEngine engine)
Gets the TLS Channel ID for the given server-side engine.
|
static String |
getHostname(SSLEngine engine)
Returns either the hostname supplied during socket creation or via
Conscrypt.Engines.setHostname(SSLEngine, String). |
static boolean |
isConscrypt(SSLEngine engine)
Indicates whether the given engine is a Conscrypt engine.
|
static int |
maxSealOverhead(SSLEngine engine)
Returns the maximum overhead, in bytes, of sealing a record with SSL.
|
static void |
setAlpnProtocols(SSLEngine engine,
String[] alpnProtocols)
Sets the list of ALPN protocols supported by the engine.
|
static void |
setChannelIdEnabled(SSLEngine engine,
boolean enabled)
Enables/disables TLS Channel ID for the given server-side engine.
|
static void |
setChannelIdPrivateKey(SSLEngine engine,
PrivateKey privateKey)
Sets the
PrivateKey to be used for TLS Channel ID by this client engine. |
static void |
setHandshakeListener(SSLEngine engine,
HandshakeListener handshakeListener)
Sets a listener on the given engine for completion of the TLS handshake
|
static void |
setHostname(SSLEngine engine,
String hostname)
This method enables Server Name Indication (SNI) and overrides the hostname supplied
during engine creation.
|
static void |
setUseSessionTickets(SSLEngine engine,
boolean useSessionTickets)
This method enables session ticket support.
|
static SSLEngineResult |
unwrap(SSLEngine engine,
ByteBuffer[] srcs,
ByteBuffer[] dsts)
Extended unwrap method for multiple source and destination buffers.
|
static SSLEngineResult |
unwrap(SSLEngine engine,
ByteBuffer[] srcs,
int srcsOffset,
int srcsLength,
ByteBuffer[] dsts,
int dstsOffset,
int dstsLength)
Exteneded unwrap method for multiple source and destination buffers.
|
public static boolean isConscrypt(SSLEngine engine)
public static void setHostname(SSLEngine engine, String hostname)
engine - the enginehostname - the desired SNI hostname, or null to disablepublic static String getHostname(SSLEngine engine)
Conscrypt.Engines.setHostname(SSLEngine, String). No DNS resolution is attempted before
returning the hostname.public static int maxSealOverhead(SSLEngine engine)
public static void setHandshakeListener(SSLEngine engine, HandshakeListener handshakeListener)
public static void setChannelIdEnabled(SSLEngine engine, boolean enabled)
This method needs to be invoked before the handshake starts.
engine - the engineenabled - Whether to enable channel ID.IllegalStateException - if this is a client engine or if the handshake has already
started.public static byte[] getChannelId(SSLEngine engine) throws SSLException
engine - the enginenull if not available.IllegalStateException - if this is a client engine or if the handshake has not yet
completed.SSLException - if channel ID is available but could not be obtained.public static void setChannelIdPrivateKey(SSLEngine engine, PrivateKey privateKey)
PrivateKey to be used for TLS Channel ID by this client engine.
This method needs to be invoked before the handshake starts.
engine - the engineprivateKey - 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 engine or if the handshake has already
started.public static SSLEngineResult unwrap(SSLEngine engine, ByteBuffer[] srcs, ByteBuffer[] dsts) throws SSLException
engine - the target engine for the unwrapsrcs - the source buffersdsts - the destination buffersSSLException - thrown if an SSL error occurredpublic static SSLEngineResult unwrap(SSLEngine engine, ByteBuffer[] srcs, int srcsOffset, int srcsLength, ByteBuffer[] dsts, int dstsOffset, int dstsLength) throws SSLException
engine - the target engine for the unwrap.srcs - the source bufferssrcsOffset - the offset in the srcs array of the first source buffersrcsLength - the number of source buffers starting at srcsOffsetdsts - the destination buffersdstsOffset - the offset in the dsts array of the first destination bufferdstsLength - the number of destination buffers starting at dstsOffsetSSLException - thrown if an SSL error occurredpublic static void setUseSessionTickets(SSLEngine engine, boolean useSessionTickets)
engine - the engineuseSessionTickets - True to enable session ticketspublic static void setAlpnProtocols(SSLEngine engine, String[] alpnProtocols)
engine - the enginealpnProtocols - the list of ALPN protocols