Package org.jgroups.protocols
Class SSL_KEY_EXCHANGE
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.KeyExchange
org.jgroups.protocols.SSL_KEY_EXCHANGE
- All Implemented Interfaces:
Lifecycle
Key exchange based on SSL sockets. The key server creates an
SSLServerSocket on a given port
and members fetch the secret key by creating a SSLSocket to the key server. The key server
authenticates the client (and vice versa) and then sends the secret key over this encrypted channel.
When the key exchange has completed, the secret key requester closes its SSL connection to the key server.
Note that this implementation should prevent man-in-the-middle attacks.
- Since:
- 4.0.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceprotected classHelper class that knows how and when to reload the SSLContext.protected static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InetAddressprotected SSLContextprotected SSL_KEY_EXCHANGE.SSLContextReloaderprotected KeyStoreprotected Stringprotected Stringprotected Stringprotected intprotected intprotected longprotected booleanprotected Stringprotected SSLContextprotected SSL_KEY_EXCHANGE.SSLContextReloaderprotected SSL_KEY_EXCHANGE.SessionVerifierprotected Stringprotected Stringprotected intprotected SSLServerSocketprotected Runnerprotected Stringprotected Stringprotected KeyStoreprotected Stringprotected Stringprotected Stringprotected ViewFields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccept()protected voidprotected SSLServerSocketprotected SSLSocketcreateSocketTo(Address target) protected SSLSocketcreateSocketTo(IpAddress dest, SSLSocketFactory sslSocketFactory) voiddestroy()This method is called on aJChannel.close().voidfetchSecretKeyFrom(Address target) Needs to fetch the secret key from a given destination (usually the key server).intgetPort()intbooleanReturns the address of the server, e.g.intprotected voidhandleView(View view) voidinit()Called after a protocol has been created and before the protocol is started.voidsetClientSSLContext(SSLContext client_ssl_ctx) setKeystore(KeyStore ks) setKeystoreName(String name) setKeystoreType(String type) setPort(int p) setPortRange(int r) setReloadThreshold(long d) setRequireClientAuthentication(boolean b) setServerSSLContext(SSLContext server_ssl_ctx) setSocketTimeout(int timeout) setSslProtocol(String protocol) setTruststoreName(String name) setTruststoreType(String type) voidstart()This method is called on aJChannel.connect(String); starts work.voidstop()Called on aJChannel.disconnect(); stops work (e.g.protected voidAn event was received from the protocol below.Methods inherited from class org.jgroups.protocols.KeyExchange
down, findProtocolAbove, getSecretKeyFromAbove, requiredUpServices, setSecretKeyAboveMethods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, down, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, providedUpServices, removePolicy, requiredDownServices, resetStatistics, resetStats, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, toString, up, up
-
Field Details
-
bind_addr
-
port
protected int port -
port_range
protected int port_range -
keystore_name
-
keystore_type
-
keystore_password
-
truststore_name
-
truststore_type
-
truststore_password
-
reload_threshold
protected long reload_threshold -
secret_key_algorithm
-
require_client_authentication
protected boolean require_client_authentication -
ssl_protocol
-
ssl_provider
-
socket_timeout
protected int socket_timeout -
session_verifier_class
-
session_verifier_arg
-
client_ssl_ctx
-
server_ssl_ctx
-
client_ssl_ctx_reloader
-
server_ssl_ctx_reloader
-
srv_sock
-
srv_sock_handler
-
key_store
-
trust_store
-
view
-
session_verifier
-
-
Constructor Details
-
SSL_KEY_EXCHANGE
public SSL_KEY_EXCHANGE()
-
-
Method Details
-
getBindAddress
-
setBindAddress
-
getPort
public int getPort() -
setPort
-
getPortRange
public int getPortRange() -
setPortRange
-
getKeystoreName
-
setKeystoreName
-
getKeystoreType
-
setKeystoreType
-
getKeystorePassword
-
setKeystorePassword
-
getTruststoreName
-
setTruststoreName
-
getTruststoreType
-
setTruststoreType
-
getTruststorePassword
-
setTruststorePassword
-
getSecretKeyAlgorithm
-
setSecretKeyAlgorithm
-
getRequireClientAuthentication
public boolean getRequireClientAuthentication() -
setRequireClientAuthentication
-
setSslProtocol
-
getSocketTimeout
public int getSocketTimeout() -
setSocketTimeout
-
getSessionVerifierClass
-
setSessionVerifierClass
-
getSessionVerifierArg
-
setSessionVerifierArg
-
getKeystore
-
setKeystore
-
getTruststore
-
setTruststore
-
getSessionVerifier
-
setSessionVerifier
-
getClientSSLContext
-
setClientSSLContext
-
getServerSSLContext
-
setServerSSLContext
-
setReloadThreshold
-
getServerLocation
Description copied from class:KeyExchangeReturns the address of the server, e.g. server socket (if any)- Specified by:
getServerLocationin classKeyExchange
-
init
Description copied from class:ProtocolCalled after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent. -
start
Description copied from class:ProtocolThis method is called on aJChannel.connect(String); starts work. Protocols are connected ready to receive events. Will be called from bottom to top. -
stop
public void stop()Description copied from class:ProtocolCalled on aJChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom. -
reloadKeystoreAndTruststore
public void reloadKeystoreAndTruststore() -
destroy
public void destroy()Description copied from class:ProtocolThis method is called on aJChannel.close(). Does some cleanup; after the call, the VM will terminate -
up
Description copied from class:ProtocolAn event was received from the protocol below. Usually the current protocol will want to examine the event type and - depending on its type - perform some computation (e.g. removing headers from a MSG event type, or updating the internal membership list when receiving a VIEW_CHANGE event). Finally, the event is either a) discarded, or b) an event is sent down the stack usingdown_prot.down()or c) the event (or another event) is sent up the stack usingup_prot.up(). -
fetchSecretKeyFrom
Description copied from class:KeyExchangeNeeds to fetch the secret key from a given destination (usually the key server). When received, the secret key (and version) needs to be installed in a protocol above usingKeyExchange.setSecretKeyAbove(Tuple).- Specified by:
fetchSecretKeyFromin classKeyExchange- Parameters:
target- The member from which to fetch the secret key- Throws:
Exception
-
accept
protected void accept() -
handleView
- Overrides:
handleViewin classKeyExchange
-
becomeKeyserver
- Throws:
Exception
-
stopKeyserver
protected void stopKeyserver() -
createServerSocket
- Throws:
Exception
-
createSocketTo
- Throws:
Exception
-
createSocketTo
-