public class SocketUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SocketUtil.SSLSocketFactory |
Modifier and Type | Field and Description |
---|---|
static String |
ALLOW_ANON |
static String |
ANON_CIPHER_SUITE |
static String |
DEFAULT_KEYSTORE_TYPE |
static String |
DEFAULT_PROTOCOL |
static String |
TRUSTSTORE_FILENAME |
Constructor and Description |
---|
SocketUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
addCipherSuite(SSLSocket engine,
String cipherSuite) |
static SSLContext |
getAnonSSLContext() |
static KeyManager[] |
getKeyManagers(String keystore,
String password,
String algorithm,
String keystoreType,
String keyAlias,
String keyPassword) |
static SSLContext |
getSSLContext(KeyManager[] keyManagers,
TrustManager[] trustManagers,
String protocol) |
static SSLContext |
getSSLContext(String keystore,
String password,
String truststore,
String truststorePassword,
String algorithm,
String keystoreType,
String protocol,
String keyAlias,
String keyPassword,
boolean trustAll,
boolean checkExpired) |
static SocketUtil.SSLSocketFactory |
getSSLSocketFactory(Properties props) |
static TrustManager[] |
getTrustAllManagers() |
static TrustManager[] |
getTrustManagers(String truststore,
String truststorePassword,
String algorithm,
String keystoreType,
boolean checkExpired) |
static KeyStore |
loadKeyStore(String name,
String password,
String type)
Load any defined keystore file, by first looking in the classpath
then looking in the file system path.
|
public static final String TRUSTSTORE_FILENAME
public static final String ALLOW_ANON
public static final String DEFAULT_KEYSTORE_TYPE
public static final String ANON_CIPHER_SUITE
public static final String DEFAULT_PROTOCOL
public static SocketUtil.SSLSocketFactory getSSLSocketFactory(Properties props) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
public static SSLContext getAnonSSLContext() throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
public static SSLContext getSSLContext(KeyManager[] keyManagers, TrustManager[] trustManagers, String protocol) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
public static SSLContext getSSLContext(String keystore, String password, String truststore, String truststorePassword, String algorithm, String keystoreType, String protocol, String keyAlias, String keyPassword, boolean trustAll, boolean checkExpired) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
public static KeyStore loadKeyStore(String name, String password, String type) throws IOException, NoSuchAlgorithmException, CertificateException, KeyStoreException
name
- - name of the keystorepassword
- - password to load the keystoretype
- - type of the keystoreIOException
NoSuchAlgorithmException
CertificateException
KeyStoreException
public static KeyManager[] getKeyManagers(String keystore, String password, String algorithm, String keystoreType, String keyAlias, String keyPassword) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
public static TrustManager[] getTrustManagers(String truststore, String truststorePassword, String algorithm, String keystoreType, boolean checkExpired) throws IOException, GeneralSecurityException
IOException
GeneralSecurityException
public static TrustManager[] getTrustAllManagers()
Copyright © 2020. All rights reserved.