public final class OpenSSLEngineSocketImpl extends OpenSSLSocketImplWrapper
| Constructor and Description |
|---|
OpenSSLEngineSocketImpl(Socket socket,
String hostname,
int port,
boolean autoClose,
SSLParametersImpl sslParameters) |
| Modifier and Type | Method and Description |
|---|---|
String |
chooseClientAlias(X509KeyManager keyManager,
X500Principal[] issuers,
String[] keyTypes) |
String |
chooseClientPSKIdentity(PSKKeyManager keyManager,
String identityHint) |
String |
chooseServerAlias(X509KeyManager keyManager,
String keyType) |
String |
chooseServerPSKIdentityHint(PSKKeyManager keyManager) |
void |
close() |
protected void |
finalize() |
byte[] |
getAlpnSelectedProtocol()
Returns the protocol agreed upon by client and server, or
null if
no protocol was agreed upon. |
SocketChannel |
getChannel() |
byte[] |
getChannelId()
Gets the TLS Channel ID for this server socket.
|
String[] |
getEnabledCipherSuites() |
String[] |
getEnabledProtocols() |
boolean |
getEnableSessionCreation() |
FileDescriptor |
getFileDescriptor$() |
InputStream |
getInputStream() |
boolean |
getNeedClientAuth() |
byte[] |
getNpnSelectedProtocol()
Returns null always for backward compatibility.
|
OutputStream |
getOutputStream() |
SecretKey |
getPSKKey(PSKKeyManager keyManager,
String identityHint,
String identity) |
SSLSession |
getSession() |
int |
getSoWriteTimeout()
Note write timeouts are not part of the javax.net.ssl.SSLSocket API
|
String[] |
getSupportedCipherSuites() |
String[] |
getSupportedProtocols() |
boolean |
getUseClientMode() |
boolean |
getWantClientAuth() |
void |
onSSLStateChange(int type,
int val)
Called when SSL state changes.
|
void |
sendUrgentData(int data) |
void |
setAlpnProtocols(byte[] alpnProtocols)
Sets the list of protocols this peer is interested in.
|
void |
setChannelIdEnabled(boolean enabled)
Enables/disables TLS Channel ID for this server socket.
|
void |
setChannelIdPrivateKey(PrivateKey privateKey)
Sets the
PrivateKey to be used for TLS Channel ID by this client socket. |
void |
setEnabledCipherSuites(String[] suites) |
void |
setEnabledProtocols(String[] protocols) |
void |
setEnableSessionCreation(boolean flag) |
void |
setHandshakeTimeout(int handshakeTimeoutMilliseconds)
Set the handshake timeout on this socket.
|
void |
setHostname(String hostname)
This method enables Server Name Indication
|
void |
setNeedClientAuth(boolean need) |
void |
setNpnProtocols(byte[] npnProtocols)
This method does nothing and is kept for backward compatibility.
|
void |
setOOBInline(boolean on) |
void |
setSoWriteTimeout(int writeTimeoutMilliseconds)
Note write timeouts are not part of the javax.net.ssl.SSLSocket API
|
void |
setUseClientMode(boolean mode) |
void |
setUseSessionTickets(boolean useSessionTickets)
This method enables session ticket support.
|
void |
setWantClientAuth(boolean want) |
void |
startHandshake()
Starts a TLS/SSL handshake on this connection using some native methods
from the OpenSSL library.
|
void |
verifyCertificateChain(long[] certRefs,
String authMethod)
Verify that we trust the certificate chain is trusted.
|
bind, connect, connect, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, setKeepAlive, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSoLinger, setTcpNoDelay, setTrafficClass, toStringaddHandshakeCompletedListener, clientCertificateRequested, clientPSKKeyRequested, getHandshakeSession, getHostname, getHostnameOrIP, getSSLParameters, removeHandshakeCompletedListener, serverPSKKeyRequested, setSoTimeout, setSSLParameterssetPerformancePreferences, setSocketImplFactory, shutdownInput, shutdownOutputpublic OpenSSLEngineSocketImpl(Socket socket, String hostname, int port, boolean autoClose, SSLParametersImpl sslParameters) throws IOException
IOExceptionpublic void startHandshake()
throws IOException
OpenSSLSocketImplstartHandshake in class OpenSSLSocketImplIOExceptionpublic void onSSLStateChange(int type,
int val)
NativeCrypto.SSLHandshakeCallbacksonSSLStateChange in interface NativeCrypto.SSLHandshakeCallbacksonSSLStateChange in class OpenSSLSocketImplpublic void verifyCertificateChain(long[] certRefs,
String authMethod)
throws CertificateException
NativeCrypto.SSLHandshakeCallbacksverifyCertificateChain in interface NativeCrypto.SSLHandshakeCallbacksverifyCertificateChain in class OpenSSLSocketImplcertRefs - chain of X.509 certificate referencesauthMethod - auth algorithm nameCertificateException - if the certificate is untrustedpublic InputStream getInputStream() throws IOException
getInputStream in class OpenSSLSocketImplIOExceptionpublic OutputStream getOutputStream() throws IOException
getOutputStream in class OpenSSLSocketImplIOExceptionpublic SSLSession getSession()
getSession in class OpenSSLSocketImplpublic boolean getEnableSessionCreation()
getEnableSessionCreation in class OpenSSLSocketImplpublic void setEnableSessionCreation(boolean flag)
setEnableSessionCreation in class OpenSSLSocketImplpublic String[] getSupportedCipherSuites()
getSupportedCipherSuites in class OpenSSLSocketImplpublic String[] getEnabledCipherSuites()
getEnabledCipherSuites in class OpenSSLSocketImplpublic void setEnabledCipherSuites(String[] suites)
setEnabledCipherSuites in class OpenSSLSocketImplpublic String[] getSupportedProtocols()
getSupportedProtocols in class OpenSSLSocketImplpublic String[] getEnabledProtocols()
getEnabledProtocols in class OpenSSLSocketImplpublic void setEnabledProtocols(String[] protocols)
setEnabledProtocols in class OpenSSLSocketImplpublic void setUseSessionTickets(boolean useSessionTickets)
OpenSSLSocketImplsetUseSessionTickets in class OpenSSLSocketImpluseSessionTickets - True to enable session ticketspublic void setHostname(String hostname)
OpenSSLSocketImplsetHostname in class OpenSSLSocketImplhostname - the desired SNI hostname, or null to disablepublic void setChannelIdEnabled(boolean enabled)
OpenSSLSocketImplThis method needs to be invoked before the handshake starts.
setChannelIdEnabled in class OpenSSLSocketImplpublic byte[] getChannelId()
throws SSLException
OpenSSLSocketImplgetChannelId in class OpenSSLSocketImplnull if not available.SSLException - if channel ID is available but could not be obtained.public void setChannelIdPrivateKey(PrivateKey privateKey)
OpenSSLSocketImplPrivateKey to be used for TLS Channel ID by this client socket.
This method needs to be invoked before the handshake starts.
setChannelIdPrivateKey in class OpenSSLSocketImplprivateKey - 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).public boolean getUseClientMode()
getUseClientMode in class OpenSSLSocketImplpublic void setUseClientMode(boolean mode)
setUseClientMode in class OpenSSLSocketImplpublic boolean getWantClientAuth()
getWantClientAuth in class OpenSSLSocketImplpublic boolean getNeedClientAuth()
getNeedClientAuth in class OpenSSLSocketImplpublic void setNeedClientAuth(boolean need)
setNeedClientAuth in class OpenSSLSocketImplpublic void setWantClientAuth(boolean want)
setWantClientAuth in class OpenSSLSocketImplpublic void sendUrgentData(int data)
throws IOException
sendUrgentData in class OpenSSLSocketImplIOExceptionpublic void setOOBInline(boolean on)
throws SocketException
setOOBInline in class OpenSSLSocketImplSocketExceptionpublic void setSoWriteTimeout(int writeTimeoutMilliseconds)
throws SocketException
OpenSSLSocketImplsetSoWriteTimeout in class OpenSSLSocketImplSocketExceptionpublic int getSoWriteTimeout()
throws SocketException
OpenSSLSocketImplgetSoWriteTimeout in class OpenSSLSocketImplSocketExceptionpublic void setHandshakeTimeout(int handshakeTimeoutMilliseconds)
throws SocketException
OpenSSLSocketImplsetHandshakeTimeout in class OpenSSLSocketImplSocketExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OpenSSLSocketImplIOExceptionprotected void finalize()
throws Throwable
finalize in class OpenSSLSocketImplThrowablepublic SocketChannel getChannel()
getChannel in class Socketpublic FileDescriptor getFileDescriptor$()
getFileDescriptor$ in class OpenSSLSocketImplpublic byte[] getNpnSelectedProtocol()
OpenSSLSocketImplgetNpnSelectedProtocol in class OpenSSLSocketImplpublic byte[] getAlpnSelectedProtocol()
OpenSSLSocketImplnull if
no protocol was agreed upon.getAlpnSelectedProtocol in class OpenSSLSocketImplpublic void setNpnProtocols(byte[] npnProtocols)
OpenSSLSocketImplsetNpnProtocols in class OpenSSLSocketImplpublic void setAlpnProtocols(byte[] alpnProtocols)
OpenSSLSocketImplnull, no protocols will be used.setAlpnProtocols in class OpenSSLSocketImplalpnProtocols - a non-empty array of protocol names. From
SSL_select_next_proto, "vector of 8-bit, length prefixed byte
strings. The length byte itself is not included in the length.
A byte string of length 0 is invalid. No byte string may be
truncated.".public String chooseServerAlias(X509KeyManager keyManager, String keyType)
chooseServerAlias in interface SSLParametersImpl.AliasChooserchooseServerAlias in class OpenSSLSocketImplpublic String chooseClientAlias(X509KeyManager keyManager, X500Principal[] issuers, String[] keyTypes)
chooseClientAlias in interface SSLParametersImpl.AliasChooserchooseClientAlias in class OpenSSLSocketImplpublic String chooseServerPSKIdentityHint(PSKKeyManager keyManager)
chooseServerPSKIdentityHint in interface SSLParametersImpl.PSKCallbackschooseServerPSKIdentityHint in class OpenSSLSocketImplpublic String chooseClientPSKIdentity(PSKKeyManager keyManager, String identityHint)
chooseClientPSKIdentity in interface SSLParametersImpl.PSKCallbackschooseClientPSKIdentity in class OpenSSLSocketImplpublic SecretKey getPSKKey(PSKKeyManager keyManager, String identityHint, String identity)
getPSKKey in interface SSLParametersImpl.PSKCallbacksgetPSKKey in class OpenSSLSocketImpl