public class TLSUtils
extends java.lang.Object
| 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 java.lang.String |
PROTO_SSL3 |
static java.lang.String |
PROTO_TLSV1 |
static java.lang.String |
PROTO_TLSV1_1 |
static java.lang.String |
PROTO_TLSV1_2 |
static java.lang.String |
PROTO_TLSV1_3 |
static java.lang.String |
SSL |
static java.lang.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(javax.net.ssl.SSLSession sslSession)
Get the channel binding data for the 'tls-server-end-point' channel binding type.
|
static java.io.FileInputStream |
getDefaultTruststoreStreamIfPossible() |
static org.jivesoftware.smack.util.TLSUtils.DefaultTrustStoreType |
getDefaultTruststoreType() |
static void |
setDefaultTrustStoreTypeToJksIfRequired()
Tries to determine if the default truststore type is of type jks and sets the javax.net.ssl.trustStoreType system
property to 'JKS' if so.
|
static void |
setEnabledProtocolsAndCiphers(javax.net.ssl.SSLSocket sslSocket,
java.lang.String[] enabledProtocols,
java.lang.String[] enabledCiphers) |
static <B extends ConnectionConfiguration.Builder<B,?>> |
setEnabledTlsProtocolsToRecommended(B builder)
Enable the recommended TLS protocols.
|
static <B extends ConnectionConfiguration.Builder<B,?>> |
setSSLv3AndTLSOnly(B builder)
Deprecated.
|
static <B extends ConnectionConfiguration.Builder<B,?>> |
setTLSOnly(B builder)
Deprecated.
|
public static final java.lang.String SSL
public static final java.lang.String TLS
public static final java.lang.String PROTO_SSL3
public static final java.lang.String PROTO_TLSV1
public static final java.lang.String PROTO_TLSV1_1
public static final java.lang.String PROTO_TLSV1_2
public static final java.lang.String PROTO_TLSV1_3
public static <B extends ConnectionConfiguration.Builder<B,?>> B setEnabledTlsProtocolsToRecommended(B builder)
B - Type of the ConnectionConfiguration builder.builder - the configuration builder to apply this setting to@Deprecated public static <B extends ConnectionConfiguration.Builder<B,?>> B setTLSOnly(B builder)
setEnabledTlsProtocolsToRecommended(org.jivesoftware.smack.ConnectionConfiguration.Builder) instead.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 to@Deprecated public static <B extends ConnectionConfiguration.Builder<B,?>> B setSSLv3AndTLSOnly(B builder)
setEnabledTlsProtocolsToRecommended(org.jivesoftware.smack.ConnectionConfiguration.Builder) instead.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)
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.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(javax.net.ssl.SSLSocket sslSocket,
java.lang.String[] enabledProtocols,
java.lang.String[] enabledCiphers)
throws SmackException.SecurityNotPossibleException
public static byte[] getChannelBindingTlsServerEndPoint(javax.net.ssl.SSLSession sslSession)
throws javax.net.ssl.SSLPeerUnverifiedException,
java.security.cert.CertificateEncodingException,
java.security.NoSuchAlgorithmException
sslSession - the SSL/TLS session from which the data should be retrieved.javax.net.ssl.SSLPeerUnverifiedException - if we TLS peer could not be verified.java.security.cert.CertificateEncodingException - if there was an encoding error with the certificate.java.security.NoSuchAlgorithmException - if no such algorithm is available.public static java.io.FileInputStream getDefaultTruststoreStreamIfPossible()
public static org.jivesoftware.smack.util.TLSUtils.DefaultTrustStoreType getDefaultTruststoreType()
throws java.io.IOException
java.io.IOExceptionpublic static void setDefaultTrustStoreTypeToJksIfRequired()