Package org.mozilla.jss.ssl.javax
Class JSSEngineReferenceImpl
- java.lang.Object
-
- javax.net.ssl.SSLEngine
-
- org.mozilla.jss.ssl.javax.JSSEngine
-
- org.mozilla.jss.ssl.javax.JSSEngineReferenceImpl
-
public class JSSEngineReferenceImpl extends JSSEngine
The reference JSSEngine implementation. This JSSEngine implementation is a reference for future JSSEngine implementations, providing a pure-Java overview of what should happen at each step of the init, wrap, and unwrap calls. This implementation allows for extended debug logging, but also debug packet logging. The latter writes out packets sent via wrap(...) and received from unwrap(...) to a port on localhost. This allows one to easily attach Wireshark or tcpdump and inspect the TLS packets, even if errors occur during the test suite (where packets aren't sent over the wire by default). This maintains the client/server relationship, and are logged as being from the appropriate side of the TLS connection.
-
-
Field Summary
-
Fields inherited from class org.mozilla.jss.ssl.javax.JSSEngine
as_server, BUFFER_SIZE, cert, certAlias, config, enabled_ciphers, handshake_state, hostname, is_inbound_closed, is_outbound_closed, key, key_managers, logger, max_protocol, min_protocol, need_client_auth, serverTemplates, session, ssl_fd, trust_managers, want_client_auth
-
-
Constructor Summary
Constructors Constructor Description JSSEngineReferenceImpl()JSSEngineReferenceImpl(java.lang.String peerHost, int peerPort)JSSEngineReferenceImpl(java.lang.String peerHost, int peerPort, X509Certificate localCert, PrivateKey localKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginHandshake()voidcleanup()Performs cleanup of internal data, closing both inbound and outbound data streams if still open.voidcloseInbound()voidcloseOutbound()voidenableSafeDebugLogging(int port)Enable writing of encrypted TLS traffic to the specified port in a client-server relationship (mirroring the actual role of this SSLEngine) to enable debugging with Wireshark.java.lang.RunnablegetDelegatedTask()javax.net.ssl.SSLEngineResult.HandshakeStatusgetHandshakeStatus()java.lang.StringgetHostname()SecurityStatusResultgetStatus()Gets the current security status of this JSSEngine instance.protected voidreconfigureClientAuth()Implementation-specific handler to handle reconfiguration of client authentication after the handshake has completed.voidsetName(java.lang.String name)voidtryCleanup()Calls cleanup only if both inbound and outbound data streams are closed.javax.net.ssl.SSLEngineResultunwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts, int offset, int length)javax.net.ssl.SSLEngineResultwrap(java.nio.ByteBuffer[] srcs, int offset, int length, java.nio.ByteBuffer dst)intwriteData(java.nio.ByteBuffer[] srcs, int offset, int length)-
Methods inherited from class org.mozilla.jss.ssl.javax.JSSEngine
addConfiguration, errorText, getDefaultConfiguration, getEnabledCipherSuites, getEnabledProtocols, getEnableSessionCreation, getNeedClientAuth, getServerTemplate, getSession, getSSLFDProxy, getSSLParameters, getSupportedCipherSuites, getSupportedProtocols, getUseClientMode, getWantClientAuth, initializeSessionCache, isInboundDone, isOutboundDone, queryEnabledCipherSuites, queryEnabledProtocols, removeConfiguration, setCertFromAlias, setConfiguration, setEnabledCipherSuites, setEnabledCipherSuites, setEnabledProtocols, setEnabledProtocols, setEnabledProtocols, setEnableSessionCreation, setHostname, setKeyManager, setKeyManagers, setKeyMaterials, setNeedClientAuth, setSSLParameters, setTrustManager, setTrustManagers, setUseClientMode, setWantClientAuth
-
-
-
-
Constructor Detail
-
JSSEngineReferenceImpl
public JSSEngineReferenceImpl()
-
JSSEngineReferenceImpl
public JSSEngineReferenceImpl(java.lang.String peerHost, int peerPort)
-
JSSEngineReferenceImpl
public JSSEngineReferenceImpl(java.lang.String peerHost, int peerPort, X509Certificate localCert, PrivateKey localKey)
-
-
Method Detail
-
setName
public void setName(java.lang.String name)
-
reconfigureClientAuth
protected void reconfigureClientAuth()
Description copied from class:JSSEngineImplementation-specific handler to handle reconfiguration of client authentication after the handshake has completed. Note that this always gets called, regardless of if the handshake has started; it is up to the implementation to handle this appropriately.- Specified by:
reconfigureClientAuthin classJSSEngine
-
beginHandshake
public void beginHandshake() throws javax.net.ssl.SSLException- Specified by:
beginHandshakein classjavax.net.ssl.SSLEngine- Throws:
javax.net.ssl.SSLException
-
closeInbound
public void closeInbound()
- Specified by:
closeInboundin classjavax.net.ssl.SSLEngine
-
closeOutbound
public void closeOutbound()
- Specified by:
closeOutboundin classjavax.net.ssl.SSLEngine
-
getHostname
public java.lang.String getHostname()
-
getDelegatedTask
public java.lang.Runnable getDelegatedTask()
- Specified by:
getDelegatedTaskin classjavax.net.ssl.SSLEngine
-
getHandshakeStatus
public javax.net.ssl.SSLEngineResult.HandshakeStatus getHandshakeStatus()
- Specified by:
getHandshakeStatusin classjavax.net.ssl.SSLEngine
-
getStatus
public SecurityStatusResult getStatus()
Description copied from class:JSSEngineGets the current security status of this JSSEngine instance. This is abstract to allow implementations to implement this (and step their handshake mechanism) as they wish.
-
enableSafeDebugLogging
public void enableSafeDebugLogging(int port)
Enable writing of encrypted TLS traffic to the specified port in a client-server relationship (mirroring the actual role of this SSLEngine) to enable debugging with Wireshark.
-
unwrap
public javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts, int offset, int length) throws java.lang.IllegalArgumentException, javax.net.ssl.SSLException- Specified by:
unwrapin classjavax.net.ssl.SSLEngine- Throws:
java.lang.IllegalArgumentExceptionjavax.net.ssl.SSLException
-
writeData
public int writeData(java.nio.ByteBuffer[] srcs, int offset, int length)
-
wrap
public javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer[] srcs, int offset, int length, java.nio.ByteBuffer dst) throws java.lang.IllegalArgumentException, javax.net.ssl.SSLException- Specified by:
wrapin classjavax.net.ssl.SSLEngine- Throws:
java.lang.IllegalArgumentExceptionjavax.net.ssl.SSLException
-
tryCleanup
public void tryCleanup()
Calls cleanup only if both inbound and outbound data streams are closed. This prevents accidental cleanup in the case of a partially open connection.- Specified by:
tryCleanupin classJSSEngine
-
-