Modifier and Type | Class and Description |
---|---|
static class |
TLSUtils.AcceptAllTrustManager
A
X509TrustManager that doesn't validate X.509 certificates. |
Modifier and Type | Field and Description |
---|---|
static String |
PROTO_SSL3 |
static String |
PROTO_TLSV1 |
static String |
PROTO_TLSV1_1 |
static String |
PROTO_TLSV1_2 |
static String |
SSL |
static String |
TLS |
Constructor and Description |
---|
TLSUtils() |
Modifier and Type | Method and Description |
---|---|
static <B extends ConnectionConfiguration.Builder<B,?>> |
acceptAllCertificates(B builder)
Accept all TLS certificates.
|
static <B extends ConnectionConfiguration.Builder<B,?>> |
disableHostnameVerificationForTlsCertificates(B builder)
Disable the hostname verification of TLS certificates.
|
static byte[] |
getChannelBindingTlsServerEndPoint(SSLSession sslSession)
Get the channel binding data for the 'tls-server-end-point' channel binding type.
|
static void |
setEnabledProtocolsAndCiphers(SSLSocket sslSocket,
String[] enabledProtocols,
String[] enabledCiphers) |
static <B extends ConnectionConfiguration.Builder<B,?>> |
setSSLv3AndTLSOnly(B builder)
Enable only TLS and SSLv3.
|
static <B extends ConnectionConfiguration.Builder<B,?>> |
setTLSOnly(B builder)
Enable only TLS.
|
public static final String SSL
public static final String TLS
public static final String PROTO_SSL3
public static final String PROTO_TLSV1
public static final String PROTO_TLSV1_1
public static final String PROTO_TLSV1_2
public TLSUtils()
public static <B extends ConnectionConfiguration.Builder<B,?>> B setTLSOnly(B builder)
According to the Encrypted XMPP Manifesto, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and TLSv1.1. This method goes one step beyond and upgrades the handshake to use TLSv1 or better. This method requires the underlying OS to support all of TLSv1.2 , 1.1 and 1.0.
B
- Type of the ConnectionConfiguration builder.builder
- the configuration builder to apply this setting topublic static <B extends ConnectionConfiguration.Builder<B,?>> B setSSLv3AndTLSOnly(B builder)
According to the Encrypted XMPP Manifesto, TLSv1.2 shall be deployed, providing fallback support for SSLv3 and TLSv1.1.
B
- Type of the ConnectionConfiguration builder.builder
- the configuration builder to apply this setting topublic static <B extends ConnectionConfiguration.Builder<B,?>> B acceptAllCertificates(B builder) throws NoSuchAlgorithmException, KeyManagementException
Warning: Use with care. This method make the Connection use TLSUtils.AcceptAllTrustManager
and essentially
invalidates all security guarantees provided by TLS. Only use this method if you understand the
implications.
B
- Type of the ConnectionConfiguration builder.builder
- a connection configuration builder.NoSuchAlgorithmException
KeyManagementException
public static <B extends ConnectionConfiguration.Builder<B,?>> B disableHostnameVerificationForTlsCertificates(B builder)
Warning: Use with care. This disables hostname verification of TLS certificates and essentially invalidates all security guarantees provided by TLS. Only use this method if you understand the implications.
B
- Type of the ConnectionConfiguration builder.builder
- a connection configuration builder.public static void setEnabledProtocolsAndCiphers(SSLSocket sslSocket, String[] enabledProtocols, String[] enabledCiphers) throws SmackException.SecurityNotPossibleException
public static byte[] getChannelBindingTlsServerEndPoint(SSLSession sslSession) throws SSLPeerUnverifiedException, CertificateEncodingException, NoSuchAlgorithmException
sslSession
- the SSL/TLS session from which the data should be retrieved.SSLPeerUnverifiedException
CertificateEncodingException
NoSuchAlgorithmException