Class SSLContextFactory


  • public final class SSLContextFactory
    extends java.lang.Object

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

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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.net.ssl.SSLEngine clientEngine​(javax.net.ssl.SSLContext theContext)
      Create an SSLEngine for a SNARL Client
      static javax.net.ssl.SSLContext createSSLContext​(java.lang.String theKeyStorePath, char[] theKeyStorePasswd, java.lang.String theTrustStorePath, char[] theTrustStorePasswd)
      Create a SSLContext w/ the default keystore type of STORE_TYPE.
      static javax.net.ssl.SSLContext createSSLContext​(java.lang.String theKeyStoreType, java.lang.String theKeyStorePath, char[] theKeyStorePasswd, java.lang.String theTrustStoreType, java.lang.String theTrustStorePath, char[] theTrustStorePasswd)
      Create a SSLContext with the specified keystore type.
      static java.lang.String path​(java.lang.String theSegment, java.lang.String... theSegments)  
      static javax.net.ssl.SSLEngine serverEngine​(javax.net.ssl.SSLContext theContext)
      Create an SSLEngine for a SNARL server
      static java.net.URL validateResourceURL​(java.lang.String thePath)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • clientEngine

        public static javax.net.ssl.SSLEngine clientEngine​(javax.net.ssl.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 javax.net.ssl.SSLEngine serverEngine​(javax.net.ssl.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 javax.net.ssl.SSLContext createSSLContext​(java.lang.String theKeyStorePath,
                                                                char[] theKeyStorePasswd,
                                                                java.lang.String theTrustStorePath,
                                                                char[] theTrustStorePasswd)
                                                         throws javax.net.ssl.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:
        javax.net.ssl.SSLException - if there was an error creating the context
      • createSSLContext

        public static javax.net.ssl.SSLContext createSSLContext​(java.lang.String theKeyStoreType,
                                                                java.lang.String theKeyStorePath,
                                                                char[] theKeyStorePasswd,
                                                                java.lang.String theTrustStoreType,
                                                                java.lang.String theTrustStorePath,
                                                                char[] theTrustStorePasswd)
                                                         throws javax.net.ssl.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:
        javax.net.ssl.SSLException - if there was an error creating the context
      • path

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

        public static java.net.URL validateResourceURL​(java.lang.String thePath)
                                                throws java.security.KeyStoreException,
                                                       java.net.MalformedURLException
        Throws:
        java.security.KeyStoreException
        java.net.MalformedURLException