Class SSL
java.lang.Object
ch.autumo.beetroot.utils.security.SSL
SSL utilities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGet key-store file.static char[]Get key-store password.static char[]getKeystorePw(boolean encodedPassword) Get key-store password.static SSLContextCreates an SSLContext.static SSLContextmakeSSLContext(String keyAndTrustStore, char[] passphrase) Creates an SSLContext.static org.apache.http.impl.client.CloseableHttpClientmakeSSLHttpClient(String keyAndTrustStore, char[] passphrase, org.apache.http.client.config.RequestConfig config) Creates an SSL HTTP client.static SSLServerSocketFactoryCreates an SSLServerSocketFactory.static SSLServerSocketFactorymakeSSLServerSocketFactory(String keyAndTrustStore, char[] passphrase) Creates an SSLServerSocketFactory.static SSLSocketFactoryCreates an SSLSocketFactory.static SSLSocketFactorymakeSSLSocketFactory(String keyAndTrustStore, char[] passphrase) Creates an SSLSocketFactory.
-
Constructor Details
-
SSL
public SSL()
-
-
Method Details
-
getKeystoreFile
Get key-store file.- Returns:
- key-store file
-
getKeystorePw
Get key-store password.- Returns:
- key-store password
- Throws:
Exception- exception
-
getKeystorePw
Get key-store password.- Parameters:
encodedPassword- is the password encoded in configuration?- Returns:
- key-store password
- Throws:
Exception- exception
-
makeSSLContext
Creates an SSLContext. Pass a KeyStore resource with your certificate and pass-phrase. Parameters read from configuration.- Returns:
- SSL context
- Throws:
Exception- exception
-
makeSSLContext
public static SSLContext makeSSLContext(String keyAndTrustStore, char[] passphrase) throws IOException Creates an SSLContext. Pass a KeyStore resource with your certificate and pass-phrase.- Parameters:
keyAndTrustStore- key-store file class-path reference or full pathpassphrase- pass phrase- Returns:
- SSL context
- Throws:
IOException- IO exception
-
makeSSLSocketFactory
Creates an SSLSocketFactory. Pass a KeyStore resource with your certificate and pass-phrase. Parameters read from configuration.- Returns:
- SSL socket factory
- Throws:
IOException- IO exceptionException
-
makeSSLSocketFactory
public static SSLSocketFactory makeSSLSocketFactory(String keyAndTrustStore, char[] passphrase) throws IOException Creates an SSLSocketFactory. Pass a KeyStore resource with your certificate and pass-phrase.- Parameters:
keyAndTrustStore- key-store file class-path reference or full pathpassphrase- pass phrase- Returns:
- SSL socket factory
- Throws:
IOException- IO exception
-
makeSSLServerSocketFactory
Creates an SSLServerSocketFactory. Pass a KeyStore resource with your certificate and pass-phrase. Parameters read from configuration.- Returns:
- SSL server socket factory
- Throws:
IOException- IO exceptionException
-
makeSSLServerSocketFactory
public static SSLServerSocketFactory makeSSLServerSocketFactory(String keyAndTrustStore, char[] passphrase) throws IOException Creates an SSLServerSocketFactory. Pass a KeyStore resource with your certificate and pass-phrase.- Parameters:
keyAndTrustStore- key-store file class-path reference or full pathpassphrase- pass phrase- Returns:
- SSL server socket factory
- Throws:
IOException- IO exception
-
makeSSLHttpClient
public static org.apache.http.impl.client.CloseableHttpClient makeSSLHttpClient(String keyAndTrustStore, char[] passphrase, org.apache.http.client.config.RequestConfig config) throws IOException Creates an SSL HTTP client. Pass a KeyStore resource with your certificate and pass-phrase. Don't forget to close the client if it has been used.- Parameters:
keyAndTrustStore- key-store file class-path reference or full pathpassphrase- pass phraseconfig- request configuration phrase- Returns:
- SSL HTTP Client
- Throws:
IOException- IO exception
-