Package com.complexible.common.net.ssl
Class SSLContextFactory
- java.lang.Object
-
- com.complexible.common.net.ssl.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 Clientstatic 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 ofSTORE_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 serverstatic java.net.URL
validateResourceURL(java.lang.String thePath)
-
-
-
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 ofSTORE_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 storetheKeyStorePasswd
- the keystore passwordtheTrustStorePath
- the location of the trust store, or null to create the context w/o a trust storetheTrustStorePasswd
- 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 typetheKeyStorePath
- the location of the keystore, or null to create the context w/o a key storetheKeyStorePasswd
- the keystore passwordtheTrustStoreType
- the trust store typetheTrustStorePath
- the location of the trust store, or null to create the context w/o a trust storetheTrustStorePasswd
- 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
-
-