public class SSLParametersImpl extends Object implements Cloneable
| Modifier and Type | Class and Description |
|---|---|
static interface |
SSLParametersImpl.AliasChooser
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) |
static interface |
SSLParametersImpl.PSKCallbacks
For abstracting the
PSKKeyManager calls between those taking an SSLSocket and
those taking an SSLEngine. |
| Modifier | Constructor and Description |
|---|---|
protected |
SSLParametersImpl(KeyManager[] kms,
TrustManager[] tms,
SecureRandom sr,
ClientSessionContext clientSessionContext,
ServerSessionContext serverSessionContext,
String[] protocols)
Initializes the parameters.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
clone()
Returns the clone of this object.
|
static String |
getClientKeyType(byte clientCertificateType)
Similar to getServerKeyType, but returns value given TLS
ClientCertificateType byte values from a CertificateRequest
message for use with X509KeyManager.chooseClientAlias or
X509ExtendedKeyManager.chooseEngineClientAlias.
|
protected ClientSessionContext |
getClientSessionContext() |
protected CTVerifier |
getCTVerifier() |
protected static SSLParametersImpl |
getDefault() |
static X509TrustManager |
getDefaultX509TrustManager()
Gets the default X.509 trust manager.
|
protected String[] |
getEnabledCipherSuites() |
protected String[] |
getEnabledProtocols() |
protected boolean |
getEnableSessionCreation()
Returns the value indicating if the peer with this parameters
allowed to cteate new SSL session
|
String |
getEndpointIdentificationAlgorithm() |
protected boolean |
getNeedClientAuth()
Returns the value indicating if the peer with this parameters tuned
to require client authentication
|
protected PSKKeyManager |
getPSKKeyManager() |
protected SecureRandom |
getSecureRandom() |
protected SecureRandom |
getSecureRandomMember() |
protected ServerSessionContext |
getServerSessionContext() |
org.conscrypt.AbstractSessionContext |
getSessionContext()
Returns the appropriate session context.
|
static Set<String> |
getSupportedClientKeyTypes(byte[] clientCertificateTypes)
Gets the supported key types for client certificates based on the
ClientCertificateType values provided by the server. |
protected boolean |
getUseClientMode()
Returns the value indicating if the parameters configured to work
in client mode.
|
protected boolean |
getUseSni()
Returns whether connections using this SSL connection should use the TLS
extension Server Name Indication (SNI).
|
protected boolean |
getWantClientAuth()
Returns the value indicating if the peer with this parameters
tuned to request client authentication
|
protected X509KeyManager |
getX509KeyManager() |
protected X509TrustManager |
getX509TrustManager() |
boolean |
isCTVerificationEnabled(String hostname)
Check if SCT verification is enforced for a given hostname.
|
void |
setCTVerificationEnabled(boolean enabled) |
void |
setCTVerifier(CTVerifier verifier) |
protected void |
setEnabledCipherSuites(String[] cipherSuites)
Sets the enabled cipher suites after filtering through OpenSSL.
|
protected void |
setEnabledProtocols(String[] protocols)
Sets the set of available protocols for use in SSL connection.
|
protected void |
setEnableSessionCreation(boolean flag)
Allows/disallows the peer holding this parameters to
create new SSL session
|
void |
setEndpointIdentificationAlgorithm(String endpointIdentificationAlgorithm) |
protected void |
setNeedClientAuth(boolean need)
Tunes the peer holding this parameters to require client authentication
|
void |
setOCSPResponse(byte[] response) |
void |
setSCTExtension(byte[] extension) |
protected void |
setUseClientMode(boolean mode)
Tunes the peer holding this parameters to work in client mode.
|
protected void |
setUseSni(boolean flag)
Whether connections using this SSL connection should use the TLS
extension Server Name Indication (SNI).
|
protected void |
setWantClientAuth(boolean want)
Tunes the peer holding this parameters to request client authentication
|
protected SSLParametersImpl(KeyManager[] kms, TrustManager[] tms, SecureRandom sr, ClientSessionContext clientSessionContext, ServerSessionContext serverSessionContext, String[] protocols) throws KeyManagementException
SSLContext.init(KeyManager[],TrustManager[],
SecureRandom) for more informationKeyManagementExceptionprotected static SSLParametersImpl getDefault() throws KeyManagementException
KeyManagementExceptionpublic org.conscrypt.AbstractSessionContext getSessionContext()
protected ServerSessionContext getServerSessionContext()
protected ClientSessionContext getClientSessionContext()
protected X509KeyManager getX509KeyManager()
null for none.protected PSKKeyManager getPSKKeyManager()
null for none.protected X509TrustManager getX509TrustManager()
null for none.protected SecureRandom getSecureRandom()
protected SecureRandom getSecureRandomMember()
protected CTVerifier getCTVerifier()
protected String[] getEnabledCipherSuites()
protected void setEnabledCipherSuites(String[] cipherSuites)
protected String[] getEnabledProtocols()
protected void setEnabledProtocols(String[] protocols)
protocols - String[]protected void setUseClientMode(boolean mode)
mode - if the peer is configured to work in client modeprotected boolean getUseClientMode()
protected void setNeedClientAuth(boolean need)
protected boolean getNeedClientAuth()
protected void setWantClientAuth(boolean want)
protected boolean getWantClientAuth()
protected void setEnableSessionCreation(boolean flag)
protected boolean getEnableSessionCreation()
protected void setUseSni(boolean flag)
protected boolean getUseSni()
public void setCTVerifier(CTVerifier verifier)
public void setCTVerificationEnabled(boolean enabled)
public void setSCTExtension(byte[] extension)
public void setOCSPResponse(byte[] response)
protected Object clone()
public static X509TrustManager getDefaultX509TrustManager() throws KeyManagementException
TODO: Move this to a published API under dalvik.system.
KeyManagementExceptionpublic String getEndpointIdentificationAlgorithm()
public void setEndpointIdentificationAlgorithm(String endpointIdentificationAlgorithm)
public static String getClientKeyType(byte clientCertificateType)
Visible for testing.
public static Set<String> getSupportedClientKeyTypes(byte[] clientCertificateTypes)
ClientCertificateType values provided by the server.clientCertificateTypes - ClientCertificateType values provided by the server.
See https://www.ietf.org/assignments/tls-parameters/tls-parameters.xml.X509KeyManager.chooseClientAlias and
X509ExtendedKeyManager.chooseEngineClientAlias.
Visible for testing.public boolean isCTVerificationEnabled(String hostname)
Security properties.
The "conscrypt.ct.enable" property must be true, as well as a per domain property.
The reverse notation of the domain name, prefixed with "conscrypt.ct.enforce."
is used as the property name.
Basic globbing is also supported.
For example, for the domain foo.bar.com, the following properties will be
looked up, in order of precedence.
- conscrypt.ct.enforce.com.bar.foo
- conscrypt.ct.enforce.com.bar.*
- conscrypt.ct.enforce.com.*
- conscrypt.ct.enforce.*