Package com.github.ambry.commons
Interface SSLFactory
-
public interface SSLFactory
Simplifies the creation of newSSLEngine
s andSSLContext
objects that can be used by components that require SSL support.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
SSLFactory.Mode
Whether the ssl engine should operate in client or server mode.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description javax.net.ssl.SSLEngine
createSSLEngine(java.lang.String peerHost, int peerPort, SSLFactory.Mode mode)
CreateSSLEngine
for given host name and port number.static SSLFactory
getNewInstance(SSLConfig sslConfig)
InstantiateSSLFactory
based on the provided config.javax.net.ssl.SSLContext
getSSLContext()
Returns a configuredSSLContext
.
-
-
-
Method Detail
-
createSSLEngine
javax.net.ssl.SSLEngine createSSLEngine(java.lang.String peerHost, int peerPort, SSLFactory.Mode mode)
CreateSSLEngine
for given host name and port number. This engine manages the handshake process and encryption/decryption with this remote host.- Parameters:
peerHost
- The remote host namepeerPort
- The remote port numbermode
- The local SSL mode, Client or Server- Returns:
- SSLEngine
-
getSSLContext
javax.net.ssl.SSLContext getSSLContext()
Returns a configuredSSLContext
. This context supports creatingSSLEngine
s and for the loaded truststore and keystore. AnSSLEngine
must be created for each connection.- Returns:
- SSLContext.
-
getNewInstance
static SSLFactory getNewInstance(SSLConfig sslConfig) throws java.lang.Exception
InstantiateSSLFactory
based on the provided config. Uses theSSLConfig.sslFactory
class name to choose the desired implementation to instantiate via reflection.- Parameters:
sslConfig
- theSSLConfig
provided to theSSLFactory
that is instantiated.- Returns:
- a new
SSLFactory
based on the provided config. - Throws:
java.lang.Exception
-
-