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.SSLEngineAbstract base class for all ConscryptSSLEngineclasses.
-
-
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.StringgetApplicationProtocol()(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.StringgetHandshakeApplicationProtocol()javax.net.ssl.SSLSessiongetHandshakeSession()(package private) abstract java.lang.StringgetHostname()Returns the hostname fromsetHostname(String)or supplied by thePeerInfoProviderupon creation.abstract java.lang.StringgetPeerHost()abstract intgetPeerPort()(package private) abstract byte[]getTlsUnique()Returns the tls-unique channel binding value for this connection, per RFC 5929.(package private) abstract javax.net.ssl.SSLSessionhandshakeSession()Work-around to allow this method to be called on older versions of Android.(package private) abstract intmaxSealOverhead()Returns the maximum overhead, in bytes, of sealing a record with SSL.(package private) abstract voidsetApplicationProtocols(java.lang.String[] protocols)Sets the list of ALPN protocols.(package private) abstract voidsetApplicationProtocolSelector(ApplicationProtocolSelector selector)Sets an application-provided ALPN protocol selector.(package private) abstract voidsetBufferAllocator(BufferAllocator bufferAllocator)(package private) abstract voidsetChannelIdEnabled(boolean enabled)Enables/disables TLS Channel ID for this server engine.(package private) abstract voidsetChannelIdPrivateKey(java.security.PrivateKey privateKey)Sets thePrivateKeyto be used for TLS Channel ID by this client engine.(package private) abstract voidsetHandshakeListener(HandshakeListener handshakeListener)Sets the listener for the completion of the TLS handshake.(package private) abstract voidsetHostname(java.lang.String hostname)This method enables Server Name Indication (SNI) and overrides thePeerInfoProvidersupplied during engine creation.(package private) abstract voidsetUseSessionTickets(boolean useSessionTickets)This method enables session ticket support.(package private) abstract javax.net.ssl.SSLEngineResultunwrap(java.nio.ByteBuffer[] srcs, int srcsOffset, int srcsLength, java.nio.ByteBuffer[] dsts, int dstsOffset, int dstsLength)(package private) abstract javax.net.ssl.SSLEngineResultunwrap(java.nio.ByteBuffer[] srcs, java.nio.ByteBuffer[] dsts)abstract javax.net.ssl.SSLEngineResultunwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer dst)abstract javax.net.ssl.SSLEngineResultunwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts)abstract javax.net.ssl.SSLEngineResultunwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts, int offset, int length)abstract javax.net.ssl.SSLEngineResultwrap(java.nio.ByteBuffer[] srcs, int srcsOffset, int srcsLength, java.nio.ByteBuffer dst)abstract javax.net.ssl.SSLEngineResultwrap(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.SSLExceptionGets the TLS Channel ID for this server engine. Channel ID is only available once the handshake completes.- Returns:
- channel ID or
nullif 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 thePrivateKeyto 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) ornullfor 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 thePeerInfoProvidersupplied during engine creation.
-
getHostname
abstract java.lang.String getHostname()
Returns the hostname fromsetHostname(String)or supplied by thePeerInfoProviderupon creation. No DNS resolution is attempted before returning the hostname.
-
getPeerHost
public abstract java.lang.String getPeerHost()
- Overrides:
getPeerHostin classjavax.net.ssl.SSLEngine
-
getPeerPort
public abstract int getPeerPort()
- Overrides:
getPeerPortin classjavax.net.ssl.SSLEngine
-
getHandshakeSession
public final javax.net.ssl.SSLSession getHandshakeSession()
- Overrides:
getHandshakeSessionin 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:
unwrapin 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:
unwrapin 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:
unwrapin 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:
wrapin 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:
wrapin 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:
getApplicationProtocolin classjavax.net.ssl.SSLEngine
-
getHandshakeApplicationProtocol
public abstract java.lang.String getHandshakeApplicationProtocol()
- Overrides:
getHandshakeApplicationProtocolin 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 returnnullif 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.SSLExceptionExports 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 benullto 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
nullif the handshake has not yet completed or the connection has been closed. - Throws:
javax.net.ssl.SSLException- if the value could not be exported.
-
-