Top Description Inners Fields Constructors Methods
org.conscrypt

pack-priv final Class SSLParametersImpl

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
java.security.AlgorithmConstraints, .KeyManagementException, .KeyStore, .KeyStoreException, .NoSuchAlgorithmException, .SecureRandom, .UnrecoverableKeyException, java.util.ArrayList, .Arrays, .Collection, .Set, javax.crypto.SecretKey, javax.net.ssl.KeyManager, .KeyManagerFactory, .SNIMatcher, .TrustManager, .TrustManagerFactory, .X509ExtendedKeyManager, .X509KeyManager, .X509TrustManager, javax.security.auth.x500.X500Principal

The instances of this class encapsulate all the info about enabled cipher suites and protocols, as well as the information about client/server mode of ssl socket, whether it require/want client authentication or not, and controls whether new SSL sessions may be established by this socket or not.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static interface
pack-priv static interface
SSLParametersImpl.PSKCallbacks

For abstracting the PSKKeyManager calls between those taking an SSLSocket and those taking an SSLEngine.

Field Summary

Modifier and TypeField and Description
private AlgorithmConstraints
pack-priv byte[]
pack-priv ApplicationProtocolSelectorAdapter
pack-priv boolean
channelIdEnabled

Whether the TLS Channel ID extension is enabled.

private boolean
private final ClientSessionContext
private boolean
private static volatile SSLParametersImpl
private static volatile X509KeyManager
private static volatile X509TrustManager
private static final String[]
private boolean
pack-priv String[]
pack-priv String[]
private String
pack-priv boolean
private boolean
pack-priv byte[]
private final PSKKeyManager
pskKeyManager

Deprecated as a consequence of PSKKeyManager being deprecated.
pack-priv byte[]
private final ServerSessionContext
private Collection<SNIMatcher>
private boolean
pack-priv boolean
private Boolean
private boolean
private final X509KeyManager
private final X509TrustManager

Constructor Summary

AccessConstructor and Description
pack-priv
SSLParametersImpl(KeyManager[] kms, TrustManager[] tms, SecureRandom sr, ClientSessionContext clientSessionContext, ServerSessionContext serverSessionContext, String[] protocols)

Initializes the parameters.

private
SSLParametersImpl(ClientSessionContext clientSessionContext, ServerSessionContext serverSessionContext, X509KeyManager x509KeyManager, PSKKeyManager pskKeyManager, X509TrustManager x509TrustManager, SSLParametersImpl sslParams)

Deprecated as a consequence of PSKKeyManager being deprecated.

Method Summary

Modifier and TypeMethod and Description
protected Object

Returns:

the clone.
clone
()

Overrides java.lang.Object.clone.

Returns the clone of this object.
pack-priv SSLParametersImpl
private static X509KeyManager
private static X509TrustManager
private static String[]
filterFromCipherSuites(String[] cipherSuites, Set<String> toRemove)

private static String[]
filterFromProtocols(String[] protocols, String obsoleteProtocol)

This filters obsoleteProtocol from the list of protocols down to help with app compatibility.

private static PSKKeyManager

Returns:

the first PSKKeyManager or null if not found.
findFirstPSKKeyManager
(KeyManager[] kms)

Deprecated as a consequence of PSKKeyManager being deprecated.
Finds the first PSKKeyManager element in the provided array.
private static X509KeyManager

Returns:

the first X509KeyManager or null if not found.
findFirstX509KeyManager
(KeyManager[] kms)

Finds the first X509KeyManager element in the provided array.

private static X509TrustManager

Returns:

the first X509ExtendedTrustManager or X509TrustManager or null if not found.
findFirstX509TrustManager
(TrustManager[] tms)

Finds the first X509TrustManager element in the provided array.

pack-priv AlgorithmConstraints
pack-priv String[]
pack-priv ApplicationProtocolSelectorAdapter
getApplicationProtocolSelector()

Returns the application protocol (ALPN) selector for this socket.

pack-priv ClientSessionContext

Returns:

client session context
getClientSessionContext
()

pack-priv static SSLParametersImpl
private static String[]
getDefaultCipherSuites(boolean x509CipherSuitesNeeded, boolean pskCipherSuitesNeeded)

private static X509KeyManager
pack-priv static X509TrustManager
getDefaultX509TrustManager()

Gets the default X.509 trust manager.

pack-priv String[]

Returns:

the names of enabled cipher suites
getEnabledCipherSuites
()

pack-priv String[]

Returns:

the set of enabled protocols
getEnabledProtocols
()

pack-priv boolean
getEnableSessionCreation()

Returns the value indicating if the peer with this parameters allowed to cteate new SSL session

pack-priv String
pack-priv boolean
getNeedClientAuth()

Returns the value indicating if the peer with this parameters tuned to require client authentication

pack-priv byte[]
pack-priv PSKKeyManager

Returns:

Pre-Shared Key (PSK) key manager or null for none.
getPSKKeyManager
()

Deprecated as a consequence of PSKKeyManager being deprecated.
pack-priv AbstractSessionContext
getSessionContext()

Returns the appropriate session context.

pack-priv Collection<SNIMatcher>
pack-priv boolean
pack-priv boolean
getUseClientMode()

Returns the value indicating if the parameters configured to work in client mode.

pack-priv boolean
getUseSni()

Returns whether connections using this SSL connection should use the TLS extension Server Name Indication (SNI).

pack-priv boolean
getWantClientAuth()

Returns the value indicating if the peer with this parameters tuned to request client authentication

pack-priv X509KeyManager

Returns:

X.509 key manager or null for none.
getX509KeyManager
()

pack-priv X509TrustManager

Returns:

X.509 trust manager or null for none.
getX509TrustManager
()

pack-priv boolean
isCTVerificationEnabled(String hostname)

Check if SCT verification is enforced for a given hostname.

private boolean
isSniEnabledByDefault()

Returns whether Server Name Indication (SNI) is enabled by default for sockets.

pack-priv void
pack-priv void
setApplicationProtocols(String[]
the list of ALPN protocols
protocols
)

Sets the list of ALPN protocols.

pack-priv void
setApplicationProtocolSelector(ApplicationProtocolSelectorAdapter applicationProtocolSelector)

Used for server-mode only.

pack-priv void
setCTVerificationEnabled(boolean enabled)

For testing only.

pack-priv void
setEnabledCipherSuites(String[] cipherSuites)

Sets the enabled cipher suites after filtering through OpenSSL.

pack-priv void
setEnabledProtocols(String[] protocols)

Sets the list of available protocols for use in SSL connection.

pack-priv void
setEnableSessionCreation(boolean flag)

Allows/disallows the peer holding this parameters to create new SSL session

pack-priv void
setEndpointIdentificationAlgorithm(String endpointIdentificationAlgorithm)

pack-priv void
setNeedClientAuth(boolean need)

Tunes the peer holding this parameters to require client authentication

pack-priv void
setOCSPResponse(byte[] response)

For testing only.

pack-priv void
setSCTExtension(byte[] extension)

For testing only.

pack-priv void
pack-priv void
setUseCipherSuitesOrder(boolean useCipherSuitesOrder)

pack-priv void
setUseClientMode(boolean
if the peer is configured to work in client mode
mode
)

Tunes the peer holding this parameters to work in client mode.

pack-priv void
setUseSessionTickets(boolean useSessionTickets)

pack-priv void
setUseSni(boolean flag)

Whether connections using this SSL connection should use the TLS extension Server Name Indication (SNI).

pack-priv void
setWantClientAuth(boolean want)

Tunes the peer holding this parameters to request client authentication

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

algorithmConstraintsback to summary
private AlgorithmConstraints algorithmConstraints
applicationProtocolsback to summary
pack-priv byte[] applicationProtocols
applicationProtocolSelectorback to summary
pack-priv ApplicationProtocolSelectorAdapter applicationProtocolSelector
channelIdEnabledback to summary
pack-priv boolean channelIdEnabled

Whether the TLS Channel ID extension is enabled. This field is server-side only.

client_modeback to summary
private boolean client_mode
clientSessionContextback to summary
private final ClientSessionContext clientSessionContext
ctVerificationEnabledback to summary
private boolean ctVerificationEnabled
defaultParametersback to summary
private static volatile SSLParametersImpl defaultParameters
defaultX509KeyManagerback to summary
private static volatile X509KeyManager defaultX509KeyManager
defaultX509TrustManagerback to summary
private static volatile X509TrustManager defaultX509TrustManager
EMPTY_STRING_ARRAYback to summary
private static final String[] EMPTY_STRING_ARRAY
enable_session_creationback to summary
private boolean enable_session_creation
enabledCipherSuitesback to summary
pack-priv String[] enabledCipherSuites
enabledProtocolsback to summary
pack-priv String[] enabledProtocols
endpointIdentificationAlgorithmback to summary
private String endpointIdentificationAlgorithm
isEnabledProtocolsFilteredback to summary
pack-priv boolean isEnabledProtocolsFiltered
need_client_authback to summary
private boolean need_client_auth
ocspResponseback to summary
pack-priv byte[] ocspResponse
pskKeyManagerback to summary
private final PSKKeyManager pskKeyManager

Deprecated

as a consequence of PSKKeyManager being deprecated. See corresponding docs for further information.

Annotations
@SuppressWarnings:deprecation
sctExtensionback to summary
pack-priv byte[] sctExtension
serverSessionContextback to summary
private final ServerSessionContext serverSessionContext
sniMatchersback to summary
private Collection<SNIMatcher> sniMatchers
useCipherSuitesOrderback to summary
private boolean useCipherSuitesOrder
useSessionTicketsback to summary
pack-priv boolean useSessionTickets
useSniback to summary
private Boolean useSni
want_client_authback to summary
private boolean want_client_auth
x509KeyManagerback to summary
private final X509KeyManager x509KeyManager
x509TrustManagerback to summary
private final X509TrustManager x509TrustManager

Constructor Detail

SSLParametersImplback to summary
pack-priv SSLParametersImpl(KeyManager[] kms, TrustManager[] tms, SecureRandom sr, ClientSessionContext clientSessionContext, ServerSessionContext serverSessionContext, String[] protocols) throws KeyManagementException

Initializes the parameters. Naturally this constructor is used in SSLContextImpl.engineInit method which directly passes its parameters. In other words this constructor holds all the functionality provided by SSLContext.init method. See javax.net.ssl.SSLContext#init(KeyManager[], TrustManager[], SecureRandom) for more information

SSLParametersImplback to summary
private SSLParametersImpl(ClientSessionContext clientSessionContext, ServerSessionContext serverSessionContext, X509KeyManager x509KeyManager, PSKKeyManager pskKeyManager, X509TrustManager x509TrustManager, SSLParametersImpl sslParams)

Deprecated

as a consequence of PSKKeyManager being deprecated. See corresponding docs for further information.

Annotations
@SuppressWarnings:deprecation

Method Detail

cloneback to summary
protected Object clone()

Overrides java.lang.Object.clone.

Returns the clone of this object.

Returns:Object

the clone.

Annotations
@Override
cloneWithTrustManagerback to summary
pack-priv SSLParametersImpl cloneWithTrustManager(X509TrustManager newTrustManager)
createDefaultX509KeyManagerback to summary
private static X509KeyManager createDefaultX509KeyManager() throws KeyManagementException
createDefaultX509TrustManagerback to summary
private static X509TrustManager createDefaultX509TrustManager() throws KeyManagementException
filterFromCipherSuitesback to summary
private static String[] filterFromCipherSuites(String[] cipherSuites, Set<String> toRemove)
filterFromProtocolsback to summary
private static String[] filterFromProtocols(String[] protocols, String obsoleteProtocol)

This filters obsoleteProtocol from the list of protocols down to help with app compatibility.

findFirstPSKKeyManagerback to summary
private static PSKKeyManager findFirstPSKKeyManager(KeyManager[] kms)

Deprecated

as a consequence of PSKKeyManager being deprecated. See corresponding docs for further information.

Finds the first PSKKeyManager element in the provided array.

Returns:PSKKeyManager

the first PSKKeyManager or null if not found.

Annotations
@SuppressWarnings:deprecation
findFirstX509KeyManagerback to summary
private static X509KeyManager findFirstX509KeyManager(KeyManager[] kms)

Finds the first X509KeyManager element in the provided array.

Returns:X509KeyManager

the first X509KeyManager or null if not found.

findFirstX509TrustManagerback to summary
private static X509TrustManager findFirstX509TrustManager(TrustManager[] tms)

Finds the first X509TrustManager element in the provided array.

Returns:X509TrustManager

the first X509ExtendedTrustManager or X509TrustManager or null if not found.

getAlgorithmConstraintsback to summary
pack-priv AlgorithmConstraints getAlgorithmConstraints()
getApplicationProtocolsback to summary
pack-priv String[] getApplicationProtocols()
getApplicationProtocolSelectorback to summary
pack-priv ApplicationProtocolSelectorAdapter getApplicationProtocolSelector()

Returns the application protocol (ALPN) selector for this socket.

getClientSessionContextback to summary
pack-priv ClientSessionContext getClientSessionContext()
Returns:ClientSessionContext

client session context

getDefaultback to summary
pack-priv static SSLParametersImpl getDefault() throws KeyManagementException
getDefaultCipherSuitesback to summary
private static String[] getDefaultCipherSuites(boolean x509CipherSuitesNeeded, boolean pskCipherSuitesNeeded)
getDefaultX509KeyManagerback to summary
private static X509KeyManager getDefaultX509KeyManager() throws KeyManagementException
getDefaultX509TrustManagerback to summary
pack-priv static X509TrustManager getDefaultX509TrustManager() throws KeyManagementException

Gets the default X.509 trust manager.

getEnabledCipherSuitesback to summary
pack-priv String[] getEnabledCipherSuites()
Returns:String[]

the names of enabled cipher suites

getEnabledProtocolsback to summary
pack-priv String[] getEnabledProtocols()
Returns:String[]

the set of enabled protocols

getEnableSessionCreationback to summary
pack-priv boolean getEnableSessionCreation()

Returns the value indicating if the peer with this parameters allowed to cteate new SSL session

getEndpointIdentificationAlgorithmback to summary
pack-priv String getEndpointIdentificationAlgorithm()
getNeedClientAuthback to summary
pack-priv boolean getNeedClientAuth()

Returns the value indicating if the peer with this parameters tuned to require client authentication

getOCSPResponseback to summary
pack-priv byte[] getOCSPResponse()
getPSKKeyManagerback to summary
pack-priv PSKKeyManager getPSKKeyManager()

Deprecated

as a consequence of PSKKeyManager being deprecated. See corresponding docs for further information.

Returns:PSKKeyManager

Pre-Shared Key (PSK) key manager or null for none.

Annotations
@SuppressWarnings:deprecation
getSessionContextback to summary
pack-priv AbstractSessionContext getSessionContext()

Returns the appropriate session context.

getSNIMatchersback to summary
pack-priv Collection<SNIMatcher> getSNIMatchers()
getUseCipherSuitesOrderback to summary
pack-priv boolean getUseCipherSuitesOrder()
getUseClientModeback to summary
pack-priv boolean getUseClientMode()

Returns the value indicating if the parameters configured to work in client mode.

getUseSniback to summary
pack-priv boolean getUseSni()

Returns whether connections using this SSL connection should use the TLS extension Server Name Indication (SNI).

getWantClientAuthback to summary
pack-priv boolean getWantClientAuth()

Returns the value indicating if the peer with this parameters tuned to request client authentication

getX509KeyManagerback to summary
pack-priv X509KeyManager getX509KeyManager()
Returns:X509KeyManager

X.509 key manager or null for none.

getX509TrustManagerback to summary
pack-priv X509TrustManager getX509TrustManager()
Returns:X509TrustManager

X.509 trust manager or null for none.

isCTVerificationEnabledback to summary
pack-priv boolean isCTVerificationEnabled(String hostname)

Check if SCT verification is enforced for a given hostname.

isSniEnabledByDefaultback to summary
private boolean isSniEnabledByDefault()

Returns whether Server Name Indication (SNI) is enabled by default for sockets. For more information on SNI, see RFC 6066 section 3.

setAlgorithmConstraintsback to summary
pack-priv void setAlgorithmConstraints(AlgorithmConstraints algorithmConstraints)
setApplicationProtocolsback to summary
pack-priv void setApplicationProtocols(String[] protocols)

Sets the list of ALPN protocols.

Parameters
protocols:String[]

the list of ALPN protocols

setApplicationProtocolSelectorback to summary
pack-priv void setApplicationProtocolSelector(ApplicationProtocolSelectorAdapter applicationProtocolSelector)

Used for server-mode only. Sets or clears the application-provided ALPN protocol selector. If set, will override the protocol list provided by setApplicationProtocols(String[]).

setCTVerificationEnabledback to summary
pack-priv void setCTVerificationEnabled(boolean enabled)

For testing only.

setEnabledCipherSuitesback to summary
pack-priv void setEnabledCipherSuites(String[] cipherSuites)

Sets the enabled cipher suites after filtering through OpenSSL.

setEnabledProtocolsback to summary
pack-priv void setEnabledProtocols(String[] protocols)

Sets the list of available protocols for use in SSL connection.

Exceptions
IllegalArgumentException:
if protocols == null
setEnableSessionCreationback to summary
pack-priv void setEnableSessionCreation(boolean flag)

Allows/disallows the peer holding this parameters to create new SSL session

setEndpointIdentificationAlgorithmback to summary
pack-priv void setEndpointIdentificationAlgorithm(String endpointIdentificationAlgorithm)
setNeedClientAuthback to summary
pack-priv void setNeedClientAuth(boolean need)

Tunes the peer holding this parameters to require client authentication

setOCSPResponseback to summary
pack-priv void setOCSPResponse(byte[] response)

For testing only.

setSCTExtensionback to summary
pack-priv void setSCTExtension(byte[] extension)

For testing only.

setSNIMatchersback to summary
pack-priv void setSNIMatchers(Collection<SNIMatcher> sniMatchers)
setUseCipherSuitesOrderback to summary
pack-priv void setUseCipherSuitesOrder(boolean useCipherSuitesOrder)
setUseClientModeback to summary
pack-priv void setUseClientMode(boolean mode)

Tunes the peer holding this parameters to work in client mode.

Parameters
mode:boolean

if the peer is configured to work in client mode

setUseSessionTicketsback to summary
pack-priv void setUseSessionTickets(boolean useSessionTickets)
setUseSniback to summary
pack-priv void setUseSni(boolean flag)

Whether connections using this SSL connection should use the TLS extension Server Name Indication (SNI).

setWantClientAuthback to summary
pack-priv void setWantClientAuth(boolean want)

Tunes the peer holding this parameters to request client authentication

org.conscrypt back to summary

pack-priv Interface SSLParametersImpl.AliasChooser

Known Direct Implementers
org.conscrypt.ConscryptEngine, org.conscrypt.ConscryptEngineSocket, org.conscrypt.ConscryptFileDescriptorSocket

For abstracting the X509KeyManager calls between X509KeyManager#chooseClientAlias(String[], java.security.Principal[], java.net.Socket) and X509ExtendedKeyManager#chooseEngineClientAlias(String[], java.security.Principal[], javax.net.ssl.SSLEngine)

Method Summary

Modifier and TypeMethod and Description
public String
chooseClientAlias(X509KeyManager keyManager, X500Principal[] issuers, String[] keyTypes)

public String

Method Detail

chooseClientAliasback to summary
public String chooseClientAlias(X509KeyManager keyManager, X500Principal[] issuers, String[] keyTypes)
chooseServerAliasback to summary
public String chooseServerAlias(X509KeyManager keyManager, String keyType)
org.conscrypt back to summary

pack-priv Interface SSLParametersImpl.PSKCallbacks

Known Direct Implementers
org.conscrypt.ConscryptEngine, org.conscrypt.ConscryptFileDescriptorSocket
Annotations
@SuppressWarnings:deprecation

For abstracting the PSKKeyManager calls between those taking an SSLSocket and those taking an SSLEngine.

Method Summary

Modifier and TypeMethod and Description
public String
chooseClientPSKIdentity(PSKKeyManager keyManager, String identityHint)

Deprecated as a consequence of PSKKeyManager being deprecated.
public String
chooseServerPSKIdentityHint(PSKKeyManager keyManager)

Deprecated as a consequence of PSKKeyManager being deprecated.
public SecretKey
getPSKKey(PSKKeyManager keyManager, String identityHint, String identity)

Deprecated as a consequence of PSKKeyManager being deprecated.

Method Detail

chooseClientPSKIdentityback to summary
public String chooseClientPSKIdentity(PSKKeyManager keyManager, String identityHint)

Deprecated

as a consequence of PSKKeyManager being deprecated. See corresponding docs for further information.

chooseServerPSKIdentityHintback to summary
public String chooseServerPSKIdentityHint(PSKKeyManager keyManager)

Deprecated

as a consequence of PSKKeyManager being deprecated. See corresponding docs for further information.

getPSKKeyback to summary
public SecretKey getPSKKey(PSKKeyManager keyManager, String identityHint, String identity)

Deprecated

as a consequence of PSKKeyManager being deprecated. See corresponding docs for further information.