Problems making SSLServerSockets
843811Oct 26 2004 — edited Oct 29 2004I have tried a couple ways to create these and both give problems.
First, I tried using SSLServerSocketFactory.getdefault(), and with this approach to making the SSLSockets, I get the socket factory and the server socket, but when I try to get the SSLSocket in order to get the iostreams to read and to write to, I get a security exception complaiing about there being no certificates for the requested protocol (this despite the fact that I created the key store by following the instructions with Tomcat 5, and my other project involving applets using https to connect to a servlet running on Tomcat works fine).
Then I tried to get an SSLConext to get a factory, using javax.net.ssl.SSLContext.getInstance("SSLv3") followed by getServerSocketFactory() called on the resulting context object. This leads to the servlet engine generating a servlet excpetion in which the root cause is identified as java.lang.IllegalStateException: SSLContext is not initialized, and the trace identifies the offending function call as that to getServerSocketFactory.
So, I appear to have two different errors, one in which there is some sort of problem with my 'self signed' certificate and another with trying to use an SSLContext object. Ideally, I should understand how each problem has arisen and how I can fix them, but at a minimum, if I can solve one of them, I can proceed with the rest of this project.
Does anone have any ideas on how I can fix either problem, or better both?
Thanks,
Ted