Package org.conscrypt
Class AbstractConscryptEngine
- java.lang.Object
-
- javax.net.ssl.SSLEngine
-
- org.conscrypt.AbstractConscryptEngine
-
- Direct Known Subclasses:
ConscryptEngine
,Java8EngineWrapper
abstract class AbstractConscryptEngine extends javax.net.ssl.SSLEngine
Abstract base class for all ConscryptSSLEngine
classes.
-
-
Constructor Summary
Constructors Constructor Description AbstractConscryptEngine()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract byte[]
exportKeyingMaterial(java.lang.String label, byte[] context, int length)
Exports a value derived from the TLS master secret as described in RFC 5705.abstract java.lang.String
getApplicationProtocol()
(package private) abstract java.lang.String[]
getApplicationProtocols()
Returns the list of supported ALPN protocols.(package private) abstract byte[]
getChannelId()
Gets the TLS Channel ID for this server engine.abstract java.lang.String
getHandshakeApplicationProtocol()
javax.net.ssl.SSLSession
getHandshakeSession()
(package private) abstract java.lang.String
getHostname()
Returns the hostname fromsetHostname(String)
or supplied by thePeerInfoProvider
upon creation.abstract java.lang.String
getPeerHost()
abstract int
getPeerPort()
(package private) abstract byte[]
getTlsUnique()
Returns the tls-unique channel binding value for this connection, per RFC 5929.(package private) abstract javax.net.ssl.SSLSession
handshakeSession()
Work-around to allow this method to be called on older versions of Android.(package private) abstract int
maxSealOverhead()
Returns the maximum overhead, in bytes, of sealing a record with SSL.(package private) abstract void
setApplicationProtocols(java.lang.String[] protocols)
Sets the list of ALPN protocols.(package private) abstract void
setApplicationProtocolSelector(ApplicationProtocolSelector selector)
Sets an application-provided ALPN protocol selector.(package private) abstract void
setBufferAllocator(BufferAllocator bufferAllocator)
(package private) abstract void
setChannelIdEnabled(boolean enabled)
Enables/disables TLS Channel ID for this server engine.(package private) abstract void
setChannelIdPrivateKey(java.security.PrivateKey privateKey)
Sets thePrivateKey
to be used for TLS Channel ID by this client engine.(package private) abstract void
setHandshakeListener(HandshakeListener handshakeListener)
Sets the listener for the completion of the TLS handshake.(package private) abstract void
setHostname(java.lang.String hostname)
This method enables Server Name Indication (SNI) and overrides thePeerInfoProvider
supplied during engine creation.(package private) abstract void
setUseSessionTickets(boolean useSessionTickets)
This method enables session ticket support.(package private) abstract javax.net.ssl.SSLEngineResult
unwrap(java.nio.ByteBuffer[] srcs, int srcsOffset, int srcsLength, java.nio.ByteBuffer[] dsts, int dstsOffset, int dstsLength)
(package private) abstract javax.net.ssl.SSLEngineResult
unwrap(java.nio.ByteBuffer[] srcs, java.nio.ByteBuffer[] dsts)
abstract javax.net.ssl.SSLEngineResult
unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer dst)
abstract javax.net.ssl.SSLEngineResult
unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts)
abstract javax.net.ssl.SSLEngineResult
unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts, int offset, int length)
abstract javax.net.ssl.SSLEngineResult
wrap(java.nio.ByteBuffer[] srcs, int srcsOffset, int srcsLength, java.nio.ByteBuffer dst)
abstract javax.net.ssl.SSLEngineResult
wrap(java.nio.ByteBuffer src, java.nio.ByteBuffer dst)
-
Methods inherited from class javax.net.ssl.SSLEngine
beginHandshake, closeInbound, closeOutbound, getDelegatedTask, getEnabledCipherSuites, getEnabledProtocols, getEnableSessionCreation, getHandshakeApplicationProtocolSelector, getHandshakeStatus, getNeedClientAuth, getSession, getSSLParameters, getSupportedCipherSuites, getSupportedProtocols, getUseClientMode, getWantClientAuth, isInboundDone, isOutboundDone, setEnabledCipherSuites, setEnabledProtocols, setEnableSessionCreation, setHandshakeApplicationProtocolSelector, setNeedClientAuth, setSSLParameters, setUseClientMode, setWantClientAuth, wrap
-
-
-
-
Method Detail
-
setBufferAllocator
abstract void setBufferAllocator(BufferAllocator bufferAllocator)
-
maxSealOverhead
abstract int maxSealOverhead()
Returns the maximum overhead, in bytes, of sealing a record with SSL.
-
setChannelIdEnabled
abstract void setChannelIdEnabled(boolean enabled)
Enables/disables TLS Channel ID for this server engine.This method needs to be invoked before the handshake starts.
- Throws:
java.lang.IllegalStateException
- if this is a client engine or if the handshake has already started.
-
getChannelId
abstract byte[] getChannelId() throws javax.net.ssl.SSLException
Gets the TLS Channel ID for this server engine. Channel ID is only available once the handshake completes.- Returns:
- channel ID or
null
if not available. - Throws:
java.lang.IllegalStateException
- if this is a client engine or if the handshake has not yet completed.javax.net.ssl.SSLException
- if channel ID is available but could not be obtained.
-
setChannelIdPrivateKey
abstract void setChannelIdPrivateKey(java.security.PrivateKey privateKey)
Sets thePrivateKey
to be used for TLS Channel ID by this client engine.This method needs to be invoked before the handshake starts.
- Parameters:
privateKey
- private key (enables TLS Channel ID) ornull
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).- Throws:
java.lang.IllegalStateException
- if this is a server engine or if the handshake has already started.
-
setHandshakeListener
abstract void setHandshakeListener(HandshakeListener handshakeListener)
Sets the listener for the completion of the TLS handshake.
-
setHostname
abstract void setHostname(java.lang.String hostname)
This method enables Server Name Indication (SNI) and overrides thePeerInfoProvider
supplied during engine creation.
-
getHostname
abstract java.lang.String getHostname()
Returns the hostname fromsetHostname(String)
or supplied by thePeerInfoProvider
upon creation. No DNS resolution is attempted before returning the hostname.
-
getPeerHost
public abstract java.lang.String getPeerHost()
- Overrides:
getPeerHost
in classjavax.net.ssl.SSLEngine
-
getPeerPort
public abstract int getPeerPort()
- Overrides:
getPeerPort
in classjavax.net.ssl.SSLEngine
-
getHandshakeSession
public final javax.net.ssl.SSLSession getHandshakeSession()
- Overrides:
getHandshakeSession
in classjavax.net.ssl.SSLEngine
-
handshakeSession
abstract javax.net.ssl.SSLSession handshakeSession()
Work-around to allow this method to be called on older versions of Android.
-
unwrap
public abstract javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer dst) throws javax.net.ssl.SSLException
- Overrides:
unwrap
in classjavax.net.ssl.SSLEngine
- Throws:
javax.net.ssl.SSLException
-
unwrap
public abstract javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts) throws javax.net.ssl.SSLException
- Overrides:
unwrap
in classjavax.net.ssl.SSLEngine
- Throws:
javax.net.ssl.SSLException
-
unwrap
public abstract javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts, int offset, int length) throws javax.net.ssl.SSLException
- Specified by:
unwrap
in classjavax.net.ssl.SSLEngine
- Throws:
javax.net.ssl.SSLException
-
unwrap
abstract javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer[] srcs, java.nio.ByteBuffer[] dsts) throws javax.net.ssl.SSLException
- Throws:
javax.net.ssl.SSLException
-
unwrap
abstract javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer[] srcs, int srcsOffset, int srcsLength, java.nio.ByteBuffer[] dsts, int dstsOffset, int dstsLength) throws javax.net.ssl.SSLException
- Throws:
javax.net.ssl.SSLException
-
wrap
public abstract javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer src, java.nio.ByteBuffer dst) throws javax.net.ssl.SSLException
- Overrides:
wrap
in classjavax.net.ssl.SSLEngine
- Throws:
javax.net.ssl.SSLException
-
wrap
public abstract javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer[] srcs, int srcsOffset, int srcsLength, java.nio.ByteBuffer dst) throws javax.net.ssl.SSLException
- Specified by:
wrap
in classjavax.net.ssl.SSLEngine
- Throws:
javax.net.ssl.SSLException
-
setUseSessionTickets
abstract void setUseSessionTickets(boolean useSessionTickets)
This method enables session ticket support.- Parameters:
useSessionTickets
- True to enable session tickets
-
setApplicationProtocols
abstract void setApplicationProtocols(java.lang.String[] protocols)
Sets the list of ALPN protocols.- Parameters:
protocols
- the list of ALPN protocols
-
getApplicationProtocols
abstract java.lang.String[] getApplicationProtocols()
Returns the list of supported ALPN protocols.
-
getApplicationProtocol
public abstract java.lang.String getApplicationProtocol()
- Overrides:
getApplicationProtocol
in classjavax.net.ssl.SSLEngine
-
getHandshakeApplicationProtocol
public abstract java.lang.String getHandshakeApplicationProtocol()
- Overrides:
getHandshakeApplicationProtocol
in classjavax.net.ssl.SSLEngine
-
setApplicationProtocolSelector
abstract void setApplicationProtocolSelector(ApplicationProtocolSelector selector)
Sets an application-provided ALPN protocol selector. If provided, this will override the list of protocols set bysetApplicationProtocols(String[])
.
-
getTlsUnique
abstract byte[] getTlsUnique()
Returns the tls-unique channel binding value for this connection, per RFC 5929. This will returnnull
if there is no such value available, such as if the handshake has not yet completed or this connection is closed.
-
exportKeyingMaterial
abstract byte[] exportKeyingMaterial(java.lang.String label, byte[] context, int length) throws javax.net.ssl.SSLException
Exports a value derived from the TLS master secret as described in RFC 5705.- Parameters:
label
- the label to use in calculating the exported value. This must be an ASCII-only string.context
- the application-specific context value to use in calculating the exported value. This may benull
to use no application context, which is treated differently than an empty byte array.length
- the number of bytes of keying material to return.- Returns:
- a value of the specified length, or
null
if the handshake has not yet completed or the connection has been closed. - Throws:
javax.net.ssl.SSLException
- if the value could not be exported.
-
-