Top Description Fields Constructors Methods
org.conscrypt

public abstract Class OpenSSLSocketImpl

extends AbstractConscryptSocket
Class Inheritance
Known Direct Subclasses
org.conscrypt.ConscryptEngineSocket, org.conscrypt.ConscryptFileDescriptorSocket
Annotations
@Internal
Imports
java.io.FileDescriptor, .IOException, java.net.InetAddress, .Socket, .SocketException, java.security.PrivateKey, javax.net.ssl.SSLException, .SSLSession

Public shim allowing us to stay backward-compatible with legacy applications which were using Conscrypt's extended socket API before the introduction of the Conscrypt class.

Field Summary

Inherited from org.conscrypt.AbstractConscryptSocket:
socket

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
OpenSSLSocketImpl(String hostname, int port)

pack-priv
OpenSSLSocketImpl(InetAddress address, int port)

pack-priv
OpenSSLSocketImpl(String hostname, int port, InetAddress clientAddress, int clientPort)

pack-priv
OpenSSLSocketImpl(InetAddress address, int port, InetAddress clientAddress, int clientPort)

pack-priv
OpenSSLSocketImpl(Socket socket, String hostname, int port, boolean autoClose)

Method Summary

Modifier and TypeMethod and Description
public final byte[]
getAlpnSelectedProtocol()

Implements abstract org.conscrypt.AbstractConscryptSocket.getAlpnSelectedProtocol.

Deprecated use getApplicationProtocol() instead.
Returns the protocol agreed upon by client and server, or null if no protocol was agreed upon.
public abstract byte[]
getChannelId()

Implements abstract org.conscrypt.AbstractConscryptSocket.getChannelId.

Gets the TLS Channel ID for this server socket.
public FileDescriptor
public abstract SSLSession
getHandshakeSession()

Implements abstract org.conscrypt.AbstractConscryptSocket.getHandshakeSession.

Returns the SSLSession being constructed during a SSL/TLS handshake.
public String
getHostname()

Overrides org.conscrypt.AbstractConscryptSocket.getHostname.

Returns the hostname that was supplied during socket creation.
public String
getHostnameOrIP()

Overrides org.conscrypt.AbstractConscryptSocket.getHostnameOrIP.

For the purposes of an SSLSession, we want a way to represent the supplied hostname or the IP address in a textual representation.
public final byte[]
getNpnSelectedProtocol()

Overrides org.conscrypt.AbstractConscryptSocket.getNpnSelectedProtocol.

Deprecated NPN is not supported
Returns null always for backward compatibility.
public int
getSoWriteTimeout()

Overrides org.conscrypt.AbstractConscryptSocket.getSoWriteTimeout.

Note write timeouts are not part of the javax.net.ssl.SSLSocket API
public final void
setAlpnProtocols(String[]
the list of ALPN protocols
alpnProtocols
)

Implements abstract org.conscrypt.AbstractConscryptSocket.setAlpnProtocols.

Deprecated use setApplicationProtocols(String[]) instead.
Sets the list of ALPN protocols.
public final void
setAlpnProtocols(byte[]
the encoded form of the ALPN protocol list
protocols
)

Implements abstract org.conscrypt.AbstractConscryptSocket.setAlpnProtocols.

Deprecated Use setAlpnProtocols(String[]) instead.
Alternate version of setAlpnProtocols(String[]) that directly sets the list of ALPN in the wire-format form used by BoringSSL (length-prefixed 8-bit strings).
public abstract void
setChannelIdEnabled(boolean enabled)

Implements abstract org.conscrypt.AbstractConscryptSocket.setChannelIdEnabled.

Enables/disables TLS Channel ID for this server socket.
public abstract void
setChannelIdPrivateKey(PrivateKey
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).
privateKey
)

Implements abstract org.conscrypt.AbstractConscryptSocket.setChannelIdPrivateKey.

Sets the PrivateKey to be used for TLS Channel ID by this client socket.
public void
setHandshakeTimeout(int handshakeTimeoutMilliseconds)

Overrides org.conscrypt.AbstractConscryptSocket.setHandshakeTimeout.

Set the handshake timeout on this socket.
public void
setHostname(String
the desired SNI hostname, or null to disable
hostname
)

Overrides org.conscrypt.AbstractConscryptSocket.setHostname.

This method enables Server Name Indication
public final void
setNpnProtocols(byte[] npnProtocols)

Overrides org.conscrypt.AbstractConscryptSocket.setNpnProtocols.

Deprecated NPN is not supported
This method does nothing and is kept for backward compatibility.
public void
setSoWriteTimeout(int writeTimeoutMilliseconds)

Overrides org.conscrypt.AbstractConscryptSocket.setSoWriteTimeout.

Note write timeouts are not part of the javax.net.ssl.SSLSocket API
public abstract void
setUseSessionTickets(boolean
True to enable session tickets
useSessionTickets
)

Implements abstract org.conscrypt.AbstractConscryptSocket.setUseSessionTickets.

This method enables session ticket support.
Inherited from org.conscrypt.AbstractConscryptSocket:
addHandshakeCompletedListenerbindcheckOpencloseconnectconnectexportKeyingMaterialgetActiveSessiongetApplicationProtocolgetApplicationProtocolsgetChannelgetHandshakeApplicationProtocolgetInetAddressgetInputStreamgetKeepAlivegetLocalAddressgetLocalPortgetLocalSocketAddressgetOOBInlinegetOutputStreamgetPortgetReceiveBufferSizegetRemoteSocketAddressgetReuseAddressgetSendBufferSizegetSoLingergetSoTimeoutgetTcpNoDelaygetTlsUniquegetTrafficClassisBoundisClosedisConnectedisInputShutdownisOutputShutdownnotifyHandshakeCompletedListenerspeerInfoProviderremoveHandshakeCompletedListenersendUrgentDatasetApplicationProtocolssetApplicationProtocolSelectorsetApplicationProtocolSelectorsetKeepAlivesetOOBInlinesetPerformancePreferencessetReceiveBufferSizesetReuseAddresssetSendBufferSizesetSoLingersetSoTimeoutsetTcpNoDelaysetTrafficClassshutdownInputshutdownOutputtoString

Constructor Detail

OpenSSLSocketImplback to summary
pack-priv OpenSSLSocketImpl() throws IOException
OpenSSLSocketImplback to summary
pack-priv OpenSSLSocketImpl(String hostname, int port) throws IOException
OpenSSLSocketImplback to summary
pack-priv OpenSSLSocketImpl(InetAddress address, int port) throws IOException
OpenSSLSocketImplback to summary
pack-priv OpenSSLSocketImpl(String hostname, int port, InetAddress clientAddress, int clientPort) throws IOException
OpenSSLSocketImplback to summary
pack-priv OpenSSLSocketImpl(InetAddress address, int port, InetAddress clientAddress, int clientPort) throws IOException
OpenSSLSocketImplback to summary
pack-priv OpenSSLSocketImpl(Socket socket, String hostname, int port, boolean autoClose) throws IOException

Method Detail

getAlpnSelectedProtocolback to summary
public final byte[] getAlpnSelectedProtocol()

Implements abstract org.conscrypt.AbstractConscryptSocket.getAlpnSelectedProtocol.

Doc from org.conscrypt.AbstractConscryptSocket.getAlpnSelectedProtocol.

Deprecated

use getApplicationProtocol() instead.

Returns the protocol agreed upon by client and server, or null if no protocol was agreed upon.

Annotations
@Override
@Deprecated
getChannelIdback to summary
public abstract byte[] getChannelId() throws SSLException

Implements abstract org.conscrypt.AbstractConscryptSocket.getChannelId.

Doc from org.conscrypt.AbstractConscryptSocket.getChannelId.

Gets the TLS Channel ID for this server socket. Channel ID is only available once the handshake completes.

Returns:byte[]

channel ID or null if not available.

Annotations
@Override
Exceptions
SSLException:
if channel ID is available but could not be obtained.
getFileDescriptor$back to summary
public FileDescriptor getFileDescriptor$()

Overrides org.conscrypt.AbstractConscryptSocket.getFileDescriptor$.

Annotations
@Override
getHandshakeSessionback to summary
public abstract SSLSession getHandshakeSession()

Implements abstract org.conscrypt.AbstractConscryptSocket.getHandshakeSession.

Doc from javax.net.ssl.SSLSocket.getHandshakeSession.

Returns the SSLSession being constructed during a SSL/TLS handshake.

TLS protocols may negotiate parameters that are needed when using an instance of this class, but before the SSLSession has been completely initialized and made available via getSession. For example, the list of valid signature algorithms may restrict the type of certificates that can be used during TrustManager decisions, or the maximum TLS fragment packet sizes can be resized to better support the network environment.

This method provides early access to the SSLSession being constructed. Depending on how far the handshake has progressed, some data may not yet be available for use. For example, if a remote server will be sending a Certificate chain, but that chain has yet not been processed, the getPeerCertificates method of SSLSession will throw a SSLPeerUnverifiedException. Once that chain has been processed, getPeerCertificates will return the proper value.

Unlike getSession(), this method does not initiate the initial handshake and does not block until handshaking is complete.

Returns:SSLSession

null if this instance is not currently handshaking, or if the current handshake has not progressed far enough to create a basic SSLSession. Otherwise, this method returns the SSLSession currently being negotiated.

Annotations
@Override
getHostnameback to summary
public String getHostname()

Overrides org.conscrypt.AbstractConscryptSocket.getHostname.

Doc from org.conscrypt.AbstractConscryptSocket.getHostname.

Returns the hostname that was supplied during socket creation. No DNS resolution is attempted before returning the hostname.

Annotations
@Override
getHostnameOrIPback to summary
public String getHostnameOrIP()

Overrides org.conscrypt.AbstractConscryptSocket.getHostnameOrIP.

Doc from org.conscrypt.AbstractConscryptSocket.getHostnameOrIP.

For the purposes of an SSLSession, we want a way to represent the supplied hostname or the IP address in a textual representation. We do not want to perform reverse DNS lookups on this address.

Annotations
@Override
getNpnSelectedProtocolback to summary
public final byte[] getNpnSelectedProtocol()

Overrides org.conscrypt.AbstractConscryptSocket.getNpnSelectedProtocol.

Doc from org.conscrypt.AbstractConscryptSocket.getNpnSelectedProtocol.

Deprecated

NPN is not supported

Returns null always for backward compatibility.

Annotations
@Override
@Deprecated
getSoWriteTimeoutback to summary
public int getSoWriteTimeout() throws SocketException

Overrides org.conscrypt.AbstractConscryptSocket.getSoWriteTimeout.

Doc from org.conscrypt.AbstractConscryptSocket.getSoWriteTimeout.

Note write timeouts are not part of the javax.net.ssl.SSLSocket API

Annotations
@Override
setAlpnProtocolsback to summary
public final void setAlpnProtocols(String[] alpnProtocols)

Implements abstract org.conscrypt.AbstractConscryptSocket.setAlpnProtocols.

Doc from org.conscrypt.AbstractConscryptSocket.setAlpnProtocols.

Deprecated

use setApplicationProtocols(String[]) instead.

Sets the list of ALPN protocols. This method internally converts the protocols to their wire-format form.

Parameters
alpnProtocols:String[]

the list of ALPN protocols

Annotations
@Override
@Deprecated
setAlpnProtocolsback to summary
public final void setAlpnProtocols(byte[] protocols)

Implements abstract org.conscrypt.AbstractConscryptSocket.setAlpnProtocols.

Doc from org.conscrypt.AbstractConscryptSocket.setAlpnProtocols.

Deprecated

Use setAlpnProtocols(String[]) instead.

Alternate version of setAlpnProtocols(String[]) that directly sets the list of ALPN in the wire-format form used by BoringSSL (length-prefixed 8-bit strings). Requires that all strings be encoded with US-ASCII.

Parameters
protocols:byte[]

the encoded form of the ALPN protocol list

Annotations
@Override
@Deprecated
setChannelIdEnabledback to summary
public abstract void setChannelIdEnabled(boolean enabled)

Implements abstract org.conscrypt.AbstractConscryptSocket.setChannelIdEnabled.

Doc from org.conscrypt.AbstractConscryptSocket.setChannelIdEnabled.

Enables/disables TLS Channel ID for this server socket.

This method needs to be invoked before the handshake starts.

Annotations
@Override
setChannelIdPrivateKeyback to summary
public abstract void setChannelIdPrivateKey(PrivateKey privateKey)

Implements abstract org.conscrypt.AbstractConscryptSocket.setChannelIdPrivateKey.

Doc from org.conscrypt.AbstractConscryptSocket.setChannelIdPrivateKey.

Sets the PrivateKey to be used for TLS Channel ID by this client socket.

This method needs to be invoked before the handshake starts.

Parameters
privateKey:PrivateKey

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).

Annotations
@Override
setHandshakeTimeoutback to summary
public void setHandshakeTimeout(int handshakeTimeoutMilliseconds) throws SocketException

Overrides org.conscrypt.AbstractConscryptSocket.setHandshakeTimeout.

Doc from org.conscrypt.AbstractConscryptSocket.setHandshakeTimeout.

Set the handshake timeout on this socket. This timeout is specified in milliseconds and will be used only during the handshake process.

Annotations
@Override
setHostnameback to summary
public void setHostname(String hostname)

Overrides org.conscrypt.AbstractConscryptSocket.setHostname.

Doc from org.conscrypt.AbstractConscryptSocket.setHostname.

This method enables Server Name Indication

Parameters
hostname:String

the desired SNI hostname, or null to disable

Annotations
@Override
setNpnProtocolsback to summary
public final void setNpnProtocols(byte[] npnProtocols)

Overrides org.conscrypt.AbstractConscryptSocket.setNpnProtocols.

Doc from org.conscrypt.AbstractConscryptSocket.setNpnProtocols.

Deprecated

NPN is not supported

This method does nothing and is kept for backward compatibility.

Annotations
@Override
@Deprecated
setSoWriteTimeoutback to summary
public void setSoWriteTimeout(int writeTimeoutMilliseconds) throws SocketException

Overrides org.conscrypt.AbstractConscryptSocket.setSoWriteTimeout.

Doc from org.conscrypt.AbstractConscryptSocket.setSoWriteTimeout.

Note write timeouts are not part of the javax.net.ssl.SSLSocket API

Annotations
@Override
setUseSessionTicketsback to summary
public abstract void setUseSessionTickets(boolean useSessionTickets)

Implements abstract org.conscrypt.AbstractConscryptSocket.setUseSessionTickets.

Doc from org.conscrypt.AbstractConscryptSocket.setUseSessionTickets.

This method enables session ticket support.

Parameters
useSessionTickets:boolean

True to enable session tickets

Annotations
@Override