I am further toward getting this SSL connection working but if someone could tell me why my applet is triggering a ‘sslv3 alert certificate unknown” error that would be great. I found this error by running “openssl s_server” and (trying) to connect to it using my Java client. I will include the source for the program. I heard it could be the lack of a trust store but I created one and it didn’t help.
public class first extends JApplet {
PrintWriter toServer = null;
BufferedReader fromServer = null;
public void init() {
System.setProperty("javax.net.ssl.keyStore", "javakeys");
System.setProperty("javax.net.ssl.keyStorePassword", "javakeys");
System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "javakeys");
try {
SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("localhost", 4000);
toServer = new PrintWriter(sslsocket.getOutputStream(), true);
toServer.println("Flystar\n\r");
InputStreamReader isr = new InputStreamReader(sslsocket.getInputStream());
fromServer = new BufferedReader(isr, 1);
JOptionPane.showMessageDialog( null, fromServer );
} catch (Exception exception) {
exception.printStackTrace();
}
// toServer.println("Flystar".getBytes());
}
public void paint(Graphics g) {
g.setColor( Color.red );
g.drawString("Welcome to Java!!", 50, 60 );
}
}
Thanks,
-Roland
“sslv3 alert certificate unknown” means that the server’s certificate is in a format that your Java client doesn’t understand.