Class SSLContextFactory

java.lang.Object
com.complexible.common.net.ssl.SSLContextFactory

public final class SSLContextFactory extends Object

Utility class for creating SSLContext instances for use by a Netty stack.

Since:
0.8
Version:
2.0
Author:
Michael Grove
  • Method Details

    • clientEngine

      public static SSLEngine clientEngine(SSLContext theContext)
      Create an SSLEngine for a SNARL Client
      Parameters:
      theContext - the client SSL context
      Returns:
      the client SSL engine created from the context
    • serverEngine

      public static SSLEngine serverEngine(SSLContext theContext)
      Create an SSLEngine for a SNARL server
      Parameters:
      theContext - the server SSL context
      Returns:
      the server SSL engine created from the context
    • createSSLContext

      public static SSLContext createSSLContext(String theKeyStorePath, char[] theKeyStorePasswd, String theTrustStorePath, char[] theTrustStorePasswd) throws SSLException
      Create a SSLContext w/ the default keystore type of STORE_TYPE. One of the keystore path or trust store path must be non-null
      Parameters:
      theKeyStorePath - the location of the keystore, or null to create the context w/o a key store
      theKeyStorePasswd - the keystore password
      theTrustStorePath - the location of the trust store, or null to create the context w/o a trust store
      theTrustStorePasswd - the trust store password
      Returns:
      the new SSLContext
      Throws:
      SSLException - if there was an error creating the context
    • createSSLContext

      public static SSLContext createSSLContext(String theKeyStoreType, String theKeyStorePath, char[] theKeyStorePasswd, String theTrustStoreType, String theTrustStorePath, char[] theTrustStorePasswd) throws SSLException
      Create a SSLContext with the specified keystore type. One of the keystore path or trust store path must be non-null
      Parameters:
      theKeyStoreType - the keystore type
      theKeyStorePath - the location of the keystore, or null to create the context w/o a key store
      theKeyStorePasswd - the keystore password
      theTrustStoreType - the trust store type
      theTrustStorePath - the location of the trust store, or null to create the context w/o a trust store
      theTrustStorePasswd - the trust store password
      Returns:
      the new SSLContext
      Throws:
      SSLException - if there was an error creating the context
    • path

      public static String path(String theSegment, String... theSegments)
    • validateResourceURL

      public static URL validateResourceURL(String thePath) throws KeyStoreException, MalformedURLException
      Throws:
      KeyStoreException
      MalformedURLException