Class SslContextFactory


  • public class SslContextFactory
    extends Object
    • Constructor Detail

      • SslContextFactory

        public SslContextFactory()
    • Method Detail

      • getInstance

        public static SSLContext getInstance​(String keyStoreName,
                                             String trustStoreName,
                                             String keyPassword)
                                      throws GeneralSecurityException
        Returns SSL context. The key store and trust store passwords are set to empty string.
        Parameters:
        keyStoreName - key store resource name; is loaded via classpath; if not found the empty keystore is used
        trustStoreName - trust store resource name; is loaded via classpath; can be set to null if you don't want to validate counterparty's certificate
        keyPassword - key password
        Returns:
        SSL context
        Throws:
        GeneralSecurityException - if security exception occurred
        NullPointerException - if (keyStoreName == null) or (keyStorePassword == null)
      • getInstance

        public static SSLContext getInstance​(String keyStoreName,
                                             String trustStoreName,
                                             String keyPassword,
                                             String keyStorePassword,
                                             String trustStorePassword)
                                      throws GeneralSecurityException
        Returns SSL context.
        Parameters:
        keyStoreName - key store resource name; is loaded via classpath; if not found the empty keystore is used
        trustStoreName - trust store resource name; is loaded via classpath; can be set to null if you don't want to validate counterparty's certificate
        keyPassword - key password
        keyStorePassword - key store password
        trustStorePassword - trust store password
        Returns:
        SSL context
        Throws:
        GeneralSecurityException - if security exception occurred
        NullPointerException - if (keyStoreName == null) or (keyStorePassword == null) or ((trustStoreName != null) && (trustStorePassword == null))
      • getInstance

        public static SSLContext getInstance​(String protocol,
                                             String keyStoreName,
                                             String trustStoreName,
                                             String keyPassword,
                                             String keyStorePassword,
                                             String trustStorePassword)
                                      throws GeneralSecurityException
        Returns SSL context.
        Parameters:
        protocol - the standard name of the requested protocol. See the SSLContext section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard protocol names.
        keyStoreName - key store resource name; is loaded via classpath; if not found the empty keystore is used
        trustStoreName - trust store resource name; is loaded via classpath; can be set to null if you don't want to validate counterparty's certificate
        keyPassword - key password
        keyStorePassword - key store password
        trustStorePassword - trust store password
        Returns:
        SSL context
        Throws:
        GeneralSecurityException - if security exception occurred
        NullPointerException - if (keyStoreName == null) or (keyStorePassword == null) or ((trustStoreName != null) && (trustStorePassword == null))