Top Description Inners Fields Constructors Methods
org.conscrypt

public final Class Conscrypt

extends Object
Class Inheritance
Annotations
@SuppressWarnings:unused
Imports
java.io.IOException, .InputStream, java.nio.ByteBuffer, java.security.KeyManagementException, .PrivateKey, .Provider, java.security.cert.X509Certificate, java.util.Properties, javax.net.ssl.HostnameVerifier, .HttpsURLConnection, .SSLContext, .SSLContextSpi, .SSLEngine, .SSLEngineResult, .SSLException, .SSLServerSocketFactory, .SSLSession, .SSLSessionContext, .SSLSocket, .SSLSocketFactory, .TrustManager, .X509TrustManager, org.conscrypt.io.IoUtils

Core API for creating and configuring all Conscrypt types.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
private static final Conscrypt.Version

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static void
checkAvailability()

Checks that the Conscrypt support is available for the system.

public static byte[]

Returns:

a value of the specified length, or null if the handshake has not yet completed or the connection has been closed.
exportKeyingMaterial
(SSLSocket socket, String
the label to use in calculating the exported value. This must be an ASCII-only string.
label
,
byte[]
the application-specific context value to use in calculating the exported value. This may be null to use no application context, which is treated differently than an empty byte array.
context
,
int
the number of bytes of keying material to return.
length
)

Exports a value derived from the TLS master secret as described in RFC 5705.

public static byte[]

Returns:

a value of the specified length, or null if the handshake has not yet completed or the connection has been closed.
exportKeyingMaterial
(SSLEngine engine, String
the label to use in calculating the exported value. This must be an ASCII-only string.
label
,
byte[]
the application-specific context value to use in calculating the exported value. This may be null to use no application context, which is treated differently than an empty byte array.
context
,
int
the number of bytes of keying material to return.
length
)

Exports a value derived from the TLS master secret as described in RFC 5705.

public static String

Returns:

the selected protocol or null if no protocol was agreed upon.
getApplicationProtocol
(SSLSocket
the socket
socket
)

Returns the ALPN protocol agreed upon by client and server.

public static String

Returns:

the selected protocol or null if no protocol was agreed upon.
getApplicationProtocol
(SSLEngine
the engine
engine
)

Returns the ALPN protocol agreed upon by client and server.

public static String[]

Returns:

the protocols in descending order of preference, or an empty array if protocol indications are not being used. Always returns a new array.
getApplicationProtocols
(SSLSocket
the socket
socket
)

Gets the application-layer protocols (ALPN) in prioritization order.

public static String[]

Returns:

the protocols in descending order of preference, or an empty array if protocol indications are not being used. Always returns a new array.
getApplicationProtocols
(SSLEngine
the engine
engine
)

Gets the application-layer protocols (ALPN) in prioritization order.

public static byte[]

Returns:

channel ID or null if not available.
getChannelId
(SSLSocket
the socket
socket
)

Gets the TLS Channel ID for the given server-side socket.

public static byte[]

Returns:

channel ID or null if not available.
getChannelId
(SSLEngine
the engine
engine
)

Gets the TLS Channel ID for the given server-side engine.

public static synchronized ConscryptHostnameVerifier
getDefaultHostnameVerifier(TrustManager trustManager)

Returns the currently-set default hostname verifier for Conscrypt trust managers.

public static X509TrustManager
getDefaultX509TrustManager()

Gets the default X.509 trust manager.

public static String
getHostname(SSLSocket socket)

Returns either the hostname supplied during socket creation or via setHostname(SSLSocket, String).

public static String
getHostname(SSLEngine engine)

Returns either the hostname supplied during socket creation or via setHostname(SSLEngine, String).

public static String
getHostnameOrIP(SSLSocket socket)

This method attempts to create a textual representation of the peer host or IP.

public static ConscryptHostnameVerifier
getHostnameVerifier(TrustManager trustManager)

Returns the currently-set hostname verifier for the given trust manager.

public static byte[]
getTlsUnique(SSLSocket socket)

Returns the tls-unique channel binding value for this connection, per RFC 5929.

public static byte[]
getTlsUnique(SSLEngine engine)

Returns the tls-unique channel binding value for this connection, per RFC 5929.

public static boolean
isAvailable()

Returns true if the Conscrypt native library has been successfully loaded.

public static boolean
isConscrypt(Provider provider)

Indicates whether the given Provider was created by this distribution of Conscrypt.

public static boolean
isConscrypt(SSLContext context)

Indicates whether the given SSLContext was created by this distribution of Conscrypt.

public static boolean
isConscrypt(SSLSocketFactory factory)

Indicates whether the given SSLSocketFactory was created by this distribution of Conscrypt.

public static boolean
isConscrypt(SSLServerSocketFactory factory)

Indicates whether the given SSLServerSocketFactory was created by this distribution of Conscrypt.

public static boolean
isConscrypt(SSLSocket socket)

Indicates whether the given SSLSocket was created by this distribution of Conscrypt.

public static boolean
isConscrypt(SSLEngine engine)

Indicates whether the given SSLEngine was created by this distribution of Conscrypt.

public static boolean
isConscrypt(TrustManager trustManager)

Indicates whether the given TrustManager was created by this distribution of Conscrypt.

public static int
maxEncryptedPacketLength()

Returns the maximum length (in bytes) of an encrypted packet.

public static int
maxSealOverhead(SSLEngine engine)

Returns the maximum overhead, in bytes, of sealing a record with SSL.

public static SSLContextSpi
newPreferredSSLContextSpi()

Constructs a new instance of the preferred SSLContextSpi.

public static Provider
newProvider()

Constructs a new Provider with the default name.

public static Provider
newProvider(String providerName)

Deprecated Use newProviderBuilder() instead.
Constructs a new Provider with the given name.
public static Conscrypt.ProviderBuilder
public static void
setApplicationProtocols(SSLSocket
the socket being configured
socket
,
String[]
the protocols in descending order of preference. If empty, no protocol indications will be used. This array will be copied.
protocols
)

Sets the application-layer protocols (ALPN) in prioritization order.

public static void
setApplicationProtocols(SSLEngine
the engine being configured
engine
,
String[]
the protocols in descending order of preference. If empty, no protocol indications will be used. This array will be copied.
protocols
)

Sets the application-layer protocols (ALPN) in prioritization order.

public static void
setApplicationProtocolSelector(SSLSocket
the socket
socket
,
ApplicationProtocolSelector
the ALPN protocol selector
selector
)

Sets an application-provided ALPN protocol selector.

public static void
setApplicationProtocolSelector(SSLEngine
the engine
engine
,
ApplicationProtocolSelector
the ALPN protocol selector
selector
)

Sets an application-provided ALPN protocol selector.

public static void
setBufferAllocator(SSLEngine engine, BufferAllocator bufferAllocator)

Provides the given engine with the provided bufferAllocator.

public static void
setBufferAllocator(SSLSocket socket, BufferAllocator bufferAllocator)

Provides the given socket with the provided bufferAllocator.

public static void
setChannelIdEnabled(SSLSocket
the socket
socket
,
boolean
Whether to enable channel ID.
enabled
)

Enables/disables TLS Channel ID for the given server-side socket.

public static void
setChannelIdEnabled(SSLEngine
the engine
engine
,
boolean
Whether to enable channel ID.
enabled
)

Enables/disables TLS Channel ID for the given server-side engine.

public static void
setChannelIdPrivateKey(SSLSocket
the socket
socket
,
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
)

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

public static void
setChannelIdPrivateKey(SSLEngine
the engine
engine
,
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
)

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

public static void
setClientSessionCache(SSLContext context, SSLClientSessionCache cache)

Sets the client-side persistent cache to be used by the context.

public static void
setDefaultBufferAllocator(BufferAllocator bufferAllocator)

Configures the default BufferAllocator to be used by all future SSLEngine instances from this provider.

public static synchronized void
setDefaultHostnameVerifier(ConscryptHostnameVerifier verifier)

Set the default hostname verifier that will be used for HTTPS endpoint identification by Conscrypt trust managers.

public static void
setHandshakeListener(SSLEngine engine, HandshakeListener handshakeListener)

Sets a listener on the given engine for completion of the TLS handshake

public static void
setHostname(SSLSocket
the socket
socket
,
String
the desired SNI hostname, or null to disable
hostname
)

This method enables Server Name Indication (SNI) and overrides the hostname supplied during socket creation.

public static void
setHostname(SSLEngine
the engine
engine
,
String
the desired SNI hostname, or null to disable
hostname
)

This method enables Server Name Indication (SNI) and overrides the hostname supplied during engine creation.

public static void
setHostnameVerifier(TrustManager trustManager, ConscryptHostnameVerifier verifier)

Set the hostname verifier that will be used for HTTPS endpoint identification by the given trust manager.

public static void
setServerSessionCache(SSLContext context, SSLServerSessionCache cache)

Sets the server-side persistent cache to be used by the context.

public static void
setUseEngineSocket(SSLSocketFactory factory, boolean useEngineSocket)

Configures the socket to be created for the given socket factory instance.

public static void
setUseEngineSocket(SSLServerSocketFactory factory, boolean useEngineSocket)

Configures the socket to be created for the given server socket factory instance.

public static void
setUseEngineSocketByDefault(boolean useEngineSocket)

Configures the default socket to be created for all socket factory instances.

public static void
setUseSessionTickets(SSLSocket
the socket
socket
,
boolean
True to enable session tickets
useSessionTickets
)

This method enables session ticket support.

public static void
setUseSessionTickets(SSLEngine
the engine
engine
,
boolean
True to enable session tickets
useSessionTickets
)

This method enables session ticket support.

private static OpenSSLSocketFactoryImpl
private static OpenSSLServerSocketFactoryImpl
private static AbstractConscryptSocket
private static AbstractConscryptEngine
private static TrustManagerImpl
toConscrypt(TrustManager trustManager)

public static SSLEngineResult

Returns:

the result of the unwrap operation
unwrap
(SSLEngine
the target engine for the unwrap
engine
,
final ByteBuffer[]
the source buffers
srcs
,
final ByteBuffer[]
the destination buffers
dsts
)

Extended unwrap method for multiple source and destination buffers.

public static SSLEngineResult

Returns:

the result of the unwrap operation
unwrap
(SSLEngine
the target engine for the unwrap.
engine
,
final ByteBuffer[]
the source buffers
srcs
,
int
the offset in the srcs array of the first source buffer
srcsOffset
,
final int
the number of source buffers starting at srcsOffset
srcsLength
,
final ByteBuffer[]
the destination buffers
dsts
,
final int
the offset in the dsts array of the first destination buffer
dstsOffset
,
final int
the number of destination buffers starting at dstsOffset
dstsLength
)

Exteneded unwrap method for multiple source and destination buffers.

public static Conscrypt.Version
version()

Returns the version of this distribution of Conscrypt.

public static ConscryptHostnameVerifier
wrapHostnameVerifier(final HostnameVerifier verifier)

Wraps the HttpsURLConnection.HostnameVerifier into a ConscryptHostnameVerifier

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait