Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

New to JSSE _ Basic question on SSL setup

843811Mar 26 2007 — edited Mar 26 2007
I'm trying to use SSL for encryption only. I don't need to implement authentication, as the app handles that at a higher level. I saw a simple example for setting up the server, from the Java Developer's Almanac. Based on that I set up the server as follows.
ServerSocketFactory ssocketFactory = SSLServerSocketFactory.getDefault();
	        sslServer = ssocketFactory.createServerSocket(sslPort);
The example doesn't show any setup of the SSL parameters, so I assume there is some default setting that should at least execute without exception. However, I get the following runtime exception:

java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at java.security.Provider$Service.newInstance(Provider.java:1245)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:220)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:147)
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:125)
at javax.net.ssl.SSLContext.getDefault(SSLContext.java:68)
at net.midnightjava.rcb.server.RCBServer.main(RCBServer.java:79)

From the API docs it looks like I could manually set some SSL parameters to specify algorithm, provider, protocols, CipherSuites, etc. But I was hoping there is some way to use an out of the box JSSE configuration. My app will not be using HTTPS. It's going to implement a secure tcp connection from client to server and I don't want the users to have know much or anything about SSL. I was hoping I could configure it to use the highest priority settings for the available parameters automatically.

Am I missing something, or do I have to set all the SSL Parameters specifically using the SSLContext class? Is there a way to make SSL work out of the box with little or no installation-specific setup?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 23 2007
Added on Mar 26 2007
2 comments
173 views