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!

SSL Sockets and Applets

843811Jan 5 2004 — edited Nov 23 2004
Overview: I need to make an Applet communicate with a server using an SSLSocket and I can't figure out how to include a truststore when running the applet in a web browser.

Background:
The applet communicates perfectly using regular non-secure sockets. I am now porting it to use secure sockets (SSLSocket, SSLServerSocket from JSSE).

The applet communicates perfectly using secure sockets when run in appletviewer with the truststore file in the classpath. I have specified the appropriate truststore properties in the Applet as follows:
System.setProperty("javax.net.ssl.trustStore", "truststore");
System.setProperty("javax.net.ssl.trustStorePassword", "password");

This works when run using appletviewer when the "truststore" file is in the classpath, and now I need to make it work in a web browser.

Problem: How do I include the "truststore" file with an Applet?

I have tried including it in the .jar file, which seems conceptually similar to including it in the classpath, which worked with appletviewer. However, including it with the .jar file doesn't work. The exception I get is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found

Any ideas on how I can include the truststore file or suggestions on another approach that will accomplish the same thing?

Thanks a lot!
-Jeff Dyck
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 21 2004
Added on Jan 5 2004
7 comments
492 views