Class JSSSocket

java.lang.Object
java.net.Socket
javax.net.ssl.SSLSocket
org.mozilla.jss.ssl.javax.JSSSocket
All Implemented Interfaces:
Closeable, AutoCloseable

public class JSSSocket extends SSLSocket
SSL-enabled socket following the javax.net.ssl.SSLSocket interface. Most users will want to use the JSSSocketFactory provided by the Java Provider interface instead of using this class directly. This SSLSocket implementation is a wrapped implementation. In particular, we need to consume an existing Socket (via the consumeSocket(...) call) which we actually send data over. When called from a socket factory, this additional socket will be automatically created for the caller. This is necessary because SSLSocketFactory includes a mode which wraps an existing socket. All JSSSocket instances have a underlying SocketChannel, of type JSSSocketChannel. Notably lacking is a javax.net.ssl.SSLSocketChannel type, so JSSSocketChannel includes no additional SSL-specific options. However, the core of the SSLEngine wrapping logic exists there. In order to interoperate with JSSEngine, many of the adjacent methods have been included in this class as well. This socket can either be a client or a server, depending on how it was created. For more information, see the javax.net.ssl.SSLSocket documentation. To construct a (useful) new instance, the following calls must be made: - new JSSSocket(); - consumeSocket(inst); - initSSLEngine(...); - setKeyManagers(...); - setTrustManagers(...); Optionally, setSSLContext(...) could be called to provide the SSLContext from which the SSLEngine should be constructed. This should be called prior to initSSLEngine(...) being called.