java.lang.Object
ch.autumo.beetroot.utils.security.SSL

public class SSL extends Object
SSL utilities.
  • Constructor Details

    • SSL

      public SSL()
  • Method Details

    • getKeystoreFile

      public static String getKeystoreFile()
      Get key-store file.
      Returns:
      key-store file
    • getKeystorePw

      public static char[] getKeystorePw() throws Exception
      Get key-store password.
      Returns:
      key-store password
      Throws:
      Exception - exception
    • getKeystorePw

      public static char[] getKeystorePw(boolean encodedPassword) throws Exception
      Get key-store password.
      Parameters:
      encodedPassword - is the password encoded in configuration?
      Returns:
      key-store password
      Throws:
      Exception - exception
    • makeSSLContext

      public static SSLContext makeSSLContext() throws Exception
      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 path
      passphrase - pass phrase
      Returns:
      SSL context
      Throws:
      IOException - IO exception
    • makeSSLSocketFactory

      public static SSLSocketFactory makeSSLSocketFactory() throws Exception
      Creates an SSLSocketFactory. Pass a KeyStore resource with your certificate and pass-phrase. Parameters read from configuration.
      Returns:
      SSL socket factory
      Throws:
      IOException - IO exception
      Exception
    • 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 path
      passphrase - pass phrase
      Returns:
      SSL socket factory
      Throws:
      IOException - IO exception
    • makeSSLServerSocketFactory

      public static SSLServerSocketFactory makeSSLServerSocketFactory() throws Exception
      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 exception
      Exception
    • 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 path
      passphrase - 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 path
      passphrase - pass phrase
      config - request configuration phrase
      Returns:
      SSL HTTP Client
      Throws:
      IOException - IO exception