Package org.conscrypt
Class ConscryptEngine
java.lang.Object
javax.net.ssl.SSLEngine
org.conscrypt.AbstractConscryptEngine
org.conscrypt.ConscryptEngine
- All Implemented Interfaces:
NativeCrypto.SSLHandshakeCallbacks
,SSLParametersImpl.AliasChooser
,SSLParametersImpl.PSKCallbacks
final class ConscryptEngine
extends AbstractConscryptEngine
implements NativeCrypto.SSLHandshakeCallbacks, SSLParametersImpl.AliasChooser, SSLParametersImpl.PSKCallbacks
Implements the
SSLEngine
API using OpenSSL's non-blocking interfaces.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ActiveSession
Set during startHandshake.private BufferAllocator
private OpenSSLKey
Private key for the TLS Channel ID extension.private static final SSLEngineResult
private SessionSnapshot
A snapshot of the active session when the engine was closed.private static BufferAllocator
private final SSLSession
The session object exposed externally from this class.private boolean
private HandshakeListener
private ByteBuffer
A lazy-created direct buffer used as a bridge between heap buffers provided by the application and JNI.private int
private static final SSLEngineResult
private static final SSLEngineResult
private static final SSLEngineResult
private static final SSLEngineResult
private final NativeSsl.BioWrapper
The BIO used for reading/writing encrypted bytes.private String
Hostname used with the TLS extension SNI hostname.private final PeerInfoProvider
private final ByteBuffer[]
private final ByteBuffer[]
private final NativeSsl
Wrapper around the underlying SSL object.private final SSLParametersImpl
private int
-
Constructor Summary
ConstructorsConstructorDescriptionConscryptEngine
(String host, int port, SSLParametersImpl sslParameters) ConscryptEngine
(SSLParametersImpl sslParameters) ConscryptEngine
(SSLParametersImpl sslParameters, PeerInfoProvider peerInfoProvider, SSLParametersImpl.AliasChooser aliasChooser) -
Method Summary
Modifier and TypeMethodDescriptionvoid
private void
private static int
calcDstsLength
(ByteBuffer[] dsts, int dstsOffset, int dstsLength) private static long
calcSrcsLength
(ByteBuffer[] srcs, int srcsOffset, int srcsEndOffset) chooseClientAlias
(X509KeyManager keyManager, X500Principal[] issuers, String[] keyTypes) chooseClientPSKIdentity
(PSKKeyManager keyManager, String identityHint) chooseServerAlias
(X509KeyManager keyManager, String keyType) chooseServerPSKIdentityHint
(PSKKeyManager keyManager) void
clientCertificateRequested
(byte[] keyTypeBytes, int[] signatureAlgs, byte[][] asn1DerEncodedPrincipals) Called on an SSL client when the server requests (or requires a certificate).int
clientPSKKeyRequested
(String identityHint, byte[] identity, byte[] key) Gets the key to be used in client mode for this connection in Pre-Shared Key (PSK) key exchange.private ClientSessionContext
private void
closeAll()
private void
void
void
private SSLException
private long
directByteBufferAddress
(ByteBuffer directBuffer, int pos) (package private) byte[]
exportKeyingMaterial
(String label, byte[] context, int length) Exports a value derived from the TLS master secret as described in RFC 5705.protected void
finalize()
private void
private void
(package private) String[]
Returns the list of supported ALPN protocols.(package private) byte[]
Gets the TLS Channel ID for this server engine.(package private) static BufferAllocator
Returns the defaultBufferAllocator
, which may benull
if no default has been explicitly set.String[]
String[]
boolean
private SSLEngineResult.Status
private SSLEngineResult.HandshakeStatus
getHandshakeStatus
(int pending) private SSLEngineResult.HandshakeStatus
(package private) String
Returns the hostname fromsetHostname(String)
or supplied by thePeerInfoProvider
upon creation.boolean
private ByteBuffer
int
getPSKKey
(PSKKeyManager keyManager, String identityHint, String identity) String[]
String[]
(package private) byte[]
Returns the tls-unique channel binding value for this connection, per RFC 5929.boolean
boolean
private SSLEngineResult.HandshakeStatus
(package private) SSLSession
Work-around to allow this method to be called on older versions of Android.private boolean
boolean
boolean
(package private) int
Returns the maximum overhead, in bytes, of sealing a record with SSL.private SSLEngineResult.HandshakeStatus
private SSLEngineResult
newResult
(int bytesConsumed, int bytesProduced, SSLEngineResult.HandshakeStatus status) private static NativeSsl
newSsl
(SSLParametersImpl sslParameters, ConscryptEngine engine, SSLParametersImpl.AliasChooser aliasChooser) private SSLException
void
onNewSessionEstablished
(long sslSessionNativePtr) Called when a new session has been established and may be added to the session cache.void
onSSLStateChange
(int type, int val) Called when SSL state changes.private int
(package private) int
private static SSLEngineResult.HandshakeStatus
pendingStatus
(int pendingOutboundBytes) private ConscryptSession
private ConscryptSession
private ConscryptSession
private int
readEncryptedData
(ByteBuffer dst, int pending) Read encrypted data from the OpenSSL network BIOprivate int
readEncryptedDataDirect
(ByteBuffer dst, int pos, int len) private int
readEncryptedDataHeap
(ByteBuffer dst, int len) private SSLEngineResult
readPendingBytesFromBIO
(ByteBuffer dst, int bytesConsumed, int bytesProduced, SSLEngineResult.HandshakeStatus status) private int
Read plaintext data from the OpenSSL internal BIOprivate int
readPlaintextDataDirect
(ByteBuffer dst, int pos, int len) private int
readPlaintextDataHeap
(ByteBuffer dst, int len) private void
private void
int
selectApplicationProtocol
(byte[] protocols) Called when acting as a server, the socket has anApplicationProtocolSelectorAdapter
associated with it, and the application protocol needs to be selected.private void
void
Called when acting as a server during ClientHello processing before a decision to resume a session is made.int
serverPSKKeyRequested
(String identityHint, String identity, byte[] key) Gets the key to be used in server mode for this connection in Pre-Shared Key (PSK) key exchange.long
serverSessionRequested
(byte[] id) Called for servers where TLS invalid input: '<' 1.3 (TLS 1.3 uses session tickets rather than application session caches).private AbstractSessionContext
(package private) void
setApplicationProtocols
(String[] protocols) Sets the list of ALPN protocols.(package private) void
Sets an application-provided ALPN protocol selector.(package private) void
(package private) void
setBufferAllocator
(BufferAllocator bufferAllocator) (package private) void
setChannelIdEnabled
(boolean enabled) Enables/disables TLS Channel ID for this server engine.(package private) void
setChannelIdPrivateKey
(PrivateKey privateKey) Sets thePrivateKey
to be used for TLS Channel ID by this client engine.(package private) static void
setDefaultBufferAllocator
(BufferAllocator bufferAllocator) Configures the defaultBufferAllocator
to be used by all futureSSLEngine
andConscryptEngineSocket
instances from this provider.void
setEnabledCipherSuites
(String[] suites) void
setEnabledProtocols
(String[] protocols) void
setEnableSessionCreation
(boolean flag) (package private) void
setHandshakeListener
(HandshakeListener handshakeListener) Sets the listener for the completion of the TLS handshake.(package private) void
setHostname
(String hostname) This method enables Server Name Indication (SNI) and overrides thePeerInfoProvider
supplied during engine creation.void
setNeedClientAuth
(boolean need) void
void
setUseClientMode
(boolean mode) (package private) void
setUseSessionTickets
(boolean useSessionTickets) This method enables session ticket support.void
setWantClientAuth
(boolean want) private ByteBuffer[]
private ByteBuffer[]
private void
transitionTo
(int newState) (package private) SSLEngineResult
unwrap
(ByteBuffer[] srcs, int srcsOffset, int srcsLength, ByteBuffer[] dsts, int dstsOffset, int dstsLength) (package private) SSLEngineResult
unwrap
(ByteBuffer[] srcs, ByteBuffer[] dsts) unwrap
(ByteBuffer src, ByteBuffer dst) unwrap
(ByteBuffer src, ByteBuffer[] dsts) unwrap
(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) void
verifyCertificateChain
(byte[][] certChain, String authMethod) Verify that the certificate chain is trusted.wrap
(ByteBuffer[] srcs, int srcsOffset, int srcsLength, ByteBuffer dst) wrap
(ByteBuffer src, ByteBuffer dst) private int
writeEncryptedData
(ByteBuffer src, int len) Write encrypted data to the OpenSSL network BIO.private int
writeEncryptedDataDirect
(ByteBuffer src, int pos, int len) private int
writeEncryptedDataHeap
(ByteBuffer src, int pos, int len) private int
writePlaintextData
(ByteBuffer src, int len) Write plaintext data to the OpenSSL internal BIO Calling this function with src.remaining == 0 is undefined.private int
writePlaintextDataDirect
(ByteBuffer src, int pos, int len) private int
writePlaintextDataHeap
(ByteBuffer src, int pos, int len) Methods inherited from class org.conscrypt.AbstractConscryptEngine
getHandshakeSession
Methods inherited from class javax.net.ssl.SSLEngine
getHandshakeApplicationProtocolSelector, setHandshakeApplicationProtocolSelector, wrap
-
Field Details
-
NEED_UNWRAP_OK
-
NEED_UNWRAP_CLOSED
-
NEED_WRAP_OK
-
NEED_WRAP_CLOSED
-
CLOSED_NOT_HANDSHAKING
-
defaultBufferAllocator
-
sslParameters
-
bufferAllocator
-
lazyDirectBuffer
A lazy-created direct buffer used as a bridge between heap buffers provided by the application and JNI. This avoids the overhead of calling JNI with heap buffers. Used only when nobufferAllocator
has been provided. -
peerHostname
Hostname used with the TLS extension SNI hostname. -
state
private int state -
handshakeFinished
private boolean handshakeFinished -
ssl
Wrapper around the underlying SSL object. -
networkBio
The BIO used for reading/writing encrypted bytes. -
activeSession
Set during startHandshake. -
closedSession
A snapshot of the active session when the engine was closed. -
externalSession
The session object exposed externally from this class. -
channelIdPrivateKey
Private key for the TLS Channel ID extension. This field is client-side only. Set during startHandshake. -
maxSealOverhead
private int maxSealOverhead -
handshakeListener
-
singleSrcBuffer
-
singleDstBuffer
-
peerInfoProvider
-
-
Constructor Details
-
ConscryptEngine
ConscryptEngine(SSLParametersImpl sslParameters) -
ConscryptEngine
ConscryptEngine(String host, int port, SSLParametersImpl sslParameters) -
ConscryptEngine
ConscryptEngine(SSLParametersImpl sslParameters, PeerInfoProvider peerInfoProvider, SSLParametersImpl.AliasChooser aliasChooser)
-
-
Method Details
-
newSsl
private static NativeSsl newSsl(SSLParametersImpl sslParameters, ConscryptEngine engine, SSLParametersImpl.AliasChooser aliasChooser) -
setDefaultBufferAllocator
Configures the defaultBufferAllocator
to be used by all futureSSLEngine
andConscryptEngineSocket
instances from this provider. -
getDefaultBufferAllocator
Returns the defaultBufferAllocator
, which may benull
if no default has been explicitly set. -
setBufferAllocator
- Specified by:
setBufferAllocator
in classAbstractConscryptEngine
-
maxSealOverhead
int maxSealOverhead()Returns the maximum overhead, in bytes, of sealing a record with SSL.- Specified by:
maxSealOverhead
in classAbstractConscryptEngine
-
setChannelIdEnabled
void setChannelIdEnabled(boolean enabled) Enables/disables TLS Channel ID for this server engine.This method needs to be invoked before the handshake starts.
- Specified by:
setChannelIdEnabled
in classAbstractConscryptEngine
- Throws:
IllegalStateException
- if this is a client engine or if the handshake has already started.
-
getChannelId
Gets the TLS Channel ID for this server engine. Channel ID is only available once the handshake completes.- Specified by:
getChannelId
in classAbstractConscryptEngine
- Returns:
- channel ID or
null
if not available. - Throws:
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.
-
setChannelIdPrivateKey
Sets thePrivateKey
to be used for TLS Channel ID by this client engine.This method needs to be invoked before the handshake starts.
- Specified by:
setChannelIdPrivateKey
in classAbstractConscryptEngine
- 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:
IllegalStateException
- if this is a server engine or if the handshake has already started.
-
setHandshakeListener
Sets the listener for the completion of the TLS handshake.- Specified by:
setHandshakeListener
in classAbstractConscryptEngine
-
isHandshakeStarted
private boolean isHandshakeStarted() -
setHostname
This method enables Server Name Indication (SNI) and overrides thePeerInfoProvider
supplied during engine creation. If the hostname is not a valid SNI hostname, the SNI extension will be omitted from the handshake.- Specified by:
setHostname
in classAbstractConscryptEngine
-
getHostname
String getHostname()Returns the hostname fromsetHostname(String)
or supplied by thePeerInfoProvider
upon creation. No DNS resolution is attempted before returning the hostname.- Specified by:
getHostname
in classAbstractConscryptEngine
-
getPeerHost
- Specified by:
getPeerHost
in classAbstractConscryptEngine
-
getPeerPort
public int getPeerPort()- Specified by:
getPeerPort
in classAbstractConscryptEngine
-
beginHandshake
- Specified by:
beginHandshake
in classSSLEngine
- Throws:
SSLException
-
beginHandshakeInternal
- Throws:
SSLException
-
closeInbound
public void closeInbound()- Specified by:
closeInbound
in classSSLEngine
-
closeOutbound
public void closeOutbound()- Specified by:
closeOutbound
in classSSLEngine
-
getDelegatedTask
- Specified by:
getDelegatedTask
in classSSLEngine
-
getEnabledCipherSuites
- Specified by:
getEnabledCipherSuites
in classSSLEngine
-
getEnabledProtocols
- Specified by:
getEnabledProtocols
in classSSLEngine
-
getEnableSessionCreation
public boolean getEnableSessionCreation()- Specified by:
getEnableSessionCreation
in classSSLEngine
-
getSSLParameters
- Overrides:
getSSLParameters
in classSSLEngine
-
setSSLParameters
- Overrides:
setSSLParameters
in classSSLEngine
-
getHandshakeStatus
- Specified by:
getHandshakeStatus
in classSSLEngine
-
getHandshakeStatusInternal
-
pendingOutboundEncryptedBytes
int pendingOutboundEncryptedBytes() -
pendingInboundCleartextBytes
private int pendingInboundCleartextBytes() -
pendingStatus
-
getNeedClientAuth
public boolean getNeedClientAuth()- Specified by:
getNeedClientAuth
in classSSLEngine
-
handshakeSession
SSLSession handshakeSession()Work-around to allow this method to be called on older versions of Android.- Specified by:
handshakeSession
in classAbstractConscryptEngine
-
getSession
- Specified by:
getSession
in classSSLEngine
-
provideSession
-
provideHandshakeSession
-
provideAfterHandshakeSession
-
getSupportedCipherSuites
- Specified by:
getSupportedCipherSuites
in classSSLEngine
-
getSupportedProtocols
- Specified by:
getSupportedProtocols
in classSSLEngine
-
getUseClientMode
public boolean getUseClientMode()- Specified by:
getUseClientMode
in classSSLEngine
-
getWantClientAuth
public boolean getWantClientAuth()- Specified by:
getWantClientAuth
in classSSLEngine
-
isInboundDone
public boolean isInboundDone()- Specified by:
isInboundDone
in classSSLEngine
-
isOutboundDone
public boolean isOutboundDone()- Specified by:
isOutboundDone
in classSSLEngine
-
setEnabledCipherSuites
- Specified by:
setEnabledCipherSuites
in classSSLEngine
-
setEnabledProtocols
- Specified by:
setEnabledProtocols
in classSSLEngine
-
setEnableSessionCreation
public void setEnableSessionCreation(boolean flag) - Specified by:
setEnableSessionCreation
in classSSLEngine
-
setNeedClientAuth
public void setNeedClientAuth(boolean need) - Specified by:
setNeedClientAuth
in classSSLEngine
-
setUseClientMode
public void setUseClientMode(boolean mode) - Specified by:
setUseClientMode
in classSSLEngine
-
setWantClientAuth
public void setWantClientAuth(boolean want) - Specified by:
setWantClientAuth
in classSSLEngine
-
unwrap
- Specified by:
unwrap
in classAbstractConscryptEngine
- Throws:
SSLException
-
unwrap
- Specified by:
unwrap
in classAbstractConscryptEngine
- Throws:
SSLException
-
unwrap
public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) throws SSLException - Specified by:
unwrap
in classAbstractConscryptEngine
- Throws:
SSLException
-
unwrap
- Specified by:
unwrap
in classAbstractConscryptEngine
- Throws:
SSLException
-
unwrap
SSLEngineResult unwrap(ByteBuffer[] srcs, int srcsOffset, int srcsLength, ByteBuffer[] dsts, int dstsOffset, int dstsLength) throws SSLException - Specified by:
unwrap
in classAbstractConscryptEngine
- Throws:
SSLException
-
calcDstsLength
-
calcSrcsLength
-
handshake
- Throws:
SSLException
-
finishHandshake
- Throws:
SSLException
-
writePlaintextData
Write plaintext data to the OpenSSL internal BIO Calling this function with src.remaining == 0 is undefined.- Throws:
SSLException
-
writePlaintextDataDirect
- Throws:
IOException
-
writePlaintextDataHeap
- Throws:
IOException
-
readPlaintextData
Read plaintext data from the OpenSSL internal BIO- Throws:
IOException
-
readPlaintextDataDirect
private int readPlaintextDataDirect(ByteBuffer dst, int pos, int len) throws IOException, CertificateException - Throws:
IOException
CertificateException
-
readPlaintextDataHeap
- Throws:
IOException
CertificateException
-
convertException
-
writeEncryptedData
Write encrypted data to the OpenSSL network BIO.- Throws:
SSLException
-
writeEncryptedDataDirect
- Throws:
IOException
-
writeEncryptedDataHeap
- Throws:
IOException
-
getOrCreateLazyDirectBuffer
-
directByteBufferAddress
-
readPendingBytesFromBIO
private SSLEngineResult readPendingBytesFromBIO(ByteBuffer dst, int bytesConsumed, int bytesProduced, SSLEngineResult.HandshakeStatus status) throws SSLException - Throws:
SSLException
-
readEncryptedData
Read encrypted data from the OpenSSL network BIO- Throws:
SSLException
-
readEncryptedDataDirect
- Throws:
IOException
-
readEncryptedDataHeap
- Throws:
IOException
-
mayFinishHandshake
private SSLEngineResult.HandshakeStatus mayFinishHandshake(SSLEngineResult.HandshakeStatus status) throws SSLException - Throws:
SSLException
-
getHandshakeStatus
-
getEngineStatus
-
closeAll
private void closeAll() -
freeIfDone
private void freeIfDone() -
newSslExceptionWithMessage
-
newResult
private SSLEngineResult newResult(int bytesConsumed, int bytesProduced, SSLEngineResult.HandshakeStatus status) throws SSLException - Throws:
SSLException
-
wrap
- Specified by:
wrap
in classAbstractConscryptEngine
- Throws:
SSLException
-
wrap
public SSLEngineResult wrap(ByteBuffer[] srcs, int srcsOffset, int srcsLength, ByteBuffer dst) throws SSLException - Specified by:
wrap
in classAbstractConscryptEngine
- Throws:
SSLException
-
clientPSKKeyRequested
Description copied from interface:NativeCrypto.SSLHandshakeCallbacks
Gets the key to be used in client mode for this connection in Pre-Shared Key (PSK) key exchange.- Specified by:
clientPSKKeyRequested
in interfaceNativeCrypto.SSLHandshakeCallbacks
- Parameters:
identityHint
- PSK identity hint provided by the server ornull
if no hint provided.identity
- buffer to be populated with PSK identity (NULL-terminated modified UTF-8) by this method. This identity will be provided to the server.key
- buffer to be populated with key material by this method.- Returns:
- number of bytes this method stored in the
key
buffer or0
if an error occurred in which case the handshake will be aborted.
-
serverPSKKeyRequested
Description copied from interface:NativeCrypto.SSLHandshakeCallbacks
Gets the key to be used in server mode for this connection in Pre-Shared Key (PSK) key exchange.- Specified by:
serverPSKKeyRequested
in interfaceNativeCrypto.SSLHandshakeCallbacks
- Parameters:
identityHint
- PSK identity hint provided by this server to the client ornull
if no hint was provided.identity
- PSK identity provided by the client.key
- buffer to be populated with key material by this method.- Returns:
- number of bytes this method stored in the
key
buffer or0
if an error occurred in which case the handshake will be aborted.
-
onSSLStateChange
public void onSSLStateChange(int type, int val) Description copied from interface:NativeCrypto.SSLHandshakeCallbacks
Called when SSL state changes. This could be handshake completion.- Specified by:
onSSLStateChange
in interfaceNativeCrypto.SSLHandshakeCallbacks
-
serverCertificateRequested
Description copied from interface:NativeCrypto.SSLHandshakeCallbacks
Called when acting as a server during ClientHello processing before a decision to resume a session is made. This allows the selection of the correct server certificate based on things like Server Name Indication (SNI).- Specified by:
serverCertificateRequested
in interfaceNativeCrypto.SSLHandshakeCallbacks
- Throws:
IOException
- if there was an error during certificate selection.
-
onNewSessionEstablished
public void onNewSessionEstablished(long sslSessionNativePtr) Description copied from interface:NativeCrypto.SSLHandshakeCallbacks
Called when a new session has been established and may be added to the session cache. The callee is responsible for incrementing the reference count on the returned session.- Specified by:
onNewSessionEstablished
in interfaceNativeCrypto.SSLHandshakeCallbacks
-
serverSessionRequested
public long serverSessionRequested(byte[] id) Description copied from interface:NativeCrypto.SSLHandshakeCallbacks
Called for servers where TLS invalid input: '<' 1.3 (TLS 1.3 uses session tickets rather than application session caches). Looks up the session by ID in the application's session cache. If a valid session is returned, this callback is responsible for incrementing the reference count (and any required synchronization).- Specified by:
serverSessionRequested
in interfaceNativeCrypto.SSLHandshakeCallbacks
- Parameters:
id
- the ID of the session to find.- Returns:
- the cached session or
0
if no session was found matching the given ID.
-
verifyCertificateChain
public void verifyCertificateChain(byte[][] certChain, String authMethod) throws CertificateException Description copied from interface:NativeCrypto.SSLHandshakeCallbacks
Verify that the certificate chain is trusted.- Specified by:
verifyCertificateChain
in interfaceNativeCrypto.SSLHandshakeCallbacks
- Parameters:
certChain
- chain of X.509 certificates in their encoded formauthMethod
- auth algorithm name- Throws:
CertificateException
- if the certificate is untrusted
-
clientCertificateRequested
public void clientCertificateRequested(byte[] keyTypeBytes, int[] signatureAlgs, byte[][] asn1DerEncodedPrincipals) throws CertificateEncodingException, SSLException Description copied from interface:NativeCrypto.SSLHandshakeCallbacks
Called on an SSL client when the server requests (or requires a certificate). The client can respond by using SSL_use_certificate and SSL_use_PrivateKey to set a certificate if has an appropriate one available, similar to how the server provides its certificate.- Specified by:
clientCertificateRequested
in interfaceNativeCrypto.SSLHandshakeCallbacks
- Parameters:
keyTypeBytes
- key types supported by the server, convertible to strings with #keyTypeasn1DerEncodedPrincipals
- CAs known to the server- Throws:
CertificateEncodingException
SSLException
-
sendSSLShutdown
private void sendSSLShutdown() -
closeAndFreeResources
private void closeAndFreeResources() -
finalize
-
chooseServerAlias
- Specified by:
chooseServerAlias
in interfaceSSLParametersImpl.AliasChooser
-
chooseClientAlias
public String chooseClientAlias(X509KeyManager keyManager, X500Principal[] issuers, String[] keyTypes) - Specified by:
chooseClientAlias
in interfaceSSLParametersImpl.AliasChooser
-
chooseServerPSKIdentityHint
- Specified by:
chooseServerPSKIdentityHint
in interfaceSSLParametersImpl.PSKCallbacks
-
chooseClientPSKIdentity
- Specified by:
chooseClientPSKIdentity
in interfaceSSLParametersImpl.PSKCallbacks
-
getPSKKey
- Specified by:
getPSKKey
in interfaceSSLParametersImpl.PSKCallbacks
-
setUseSessionTickets
void setUseSessionTickets(boolean useSessionTickets) This method enables session ticket support.- Specified by:
setUseSessionTickets
in classAbstractConscryptEngine
- Parameters:
useSessionTickets
- True to enable session tickets
-
getApplicationProtocols
String[] getApplicationProtocols()Description copied from class:AbstractConscryptEngine
Returns the list of supported ALPN protocols.- Specified by:
getApplicationProtocols
in classAbstractConscryptEngine
-
setApplicationProtocols
Description copied from class:AbstractConscryptEngine
Sets the list of ALPN protocols.- Specified by:
setApplicationProtocols
in classAbstractConscryptEngine
- Parameters:
protocols
- the list of ALPN protocols
-
setApplicationProtocolSelector
Description copied from class:AbstractConscryptEngine
Sets an application-provided ALPN protocol selector. If provided, this will override the list of protocols set byAbstractConscryptEngine.setApplicationProtocols(String[])
.- Specified by:
setApplicationProtocolSelector
in classAbstractConscryptEngine
-
getTlsUnique
byte[] getTlsUnique()Description copied from class:AbstractConscryptEngine
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.- Specified by:
getTlsUnique
in classAbstractConscryptEngine
-
exportKeyingMaterial
Description copied from class:AbstractConscryptEngine
Exports a value derived from the TLS master secret as described in RFC 5705.- Specified by:
exportKeyingMaterial
in classAbstractConscryptEngine
- 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:
SSLException
- if the value could not be exported.
-
setApplicationProtocolSelector
-
selectApplicationProtocol
public int selectApplicationProtocol(byte[] protocols) Description copied from interface:NativeCrypto.SSLHandshakeCallbacks
Called when acting as a server, the socket has anApplicationProtocolSelectorAdapter
associated with it, and the application protocol needs to be selected.- Specified by:
selectApplicationProtocol
in interfaceNativeCrypto.SSLHandshakeCallbacks
- Parameters:
protocols
- list of application protocols in length-prefix format- Returns:
- the index offset of the selected protocol
-
getApplicationProtocol
- Specified by:
getApplicationProtocol
in classAbstractConscryptEngine
-
getHandshakeApplicationProtocol
- Specified by:
getHandshakeApplicationProtocol
in classAbstractConscryptEngine
-
singleSrcBuffer
-
resetSingleSrcBuffer
private void resetSingleSrcBuffer() -
singleDstBuffer
-
resetSingleDstBuffer
private void resetSingleDstBuffer() -
clientSessionContext
-
sessionContext
-
transitionTo
private void transitionTo(int newState)
-