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!

Please help.javax.net.ssl.SSLHandshakeException.

843811Sep 11 2008 — edited Sep 26 2008
I ran the test server:

public class TestSrv extends UnicastRemoteObject implements TestS{

private static final int portNumber = 1242;

private TestSrv() throws RemoteException {
super(0,new SslRMIClientSocketFactory(),new SslRMIServerSocketFactory());
}

public String getMessage() throws RemoteException{
return "Hello All";
}

public static void main(String[] args) {
System.setProperty("javax.net.ssl.keyStore","/home/rzheva/Server_Keystore");
System.setProperty("javax.net.ssl.keyStorePassword","password");
System.setProperty("javax.net.ssl.trustStore","/home/rzheva/Client_Truststore");
System.setProperty("javax.net.ssl.trustStorePassword","password");
System.setProperty("security.provider.3","com.sun.net.ssl.internal.ssl.Provider");
System.setProperty("javax.net.debug","all");
System.setProperty("java.security.policy","/home/rzheva/test/java.policy");

if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}

try{
String name = HOST + portNumber + "/TestSrv";
TestSrv serv = new TestSrv();
LocateRegistry.createRegistry(portNumber);
Registry registry = LocateRegistry.getRegistry(portNumber);
registry.rebind(name, serv);
System.out.println("main: TestSrv bound on " + name);

}catch(Exception e){
System.out.println("ERROR!!");
e.printStackTrace();
}
}

}

It binds ok, at least i can see in by jps command and i can see "bound" in logs.

Then i run client and i get exception:

........
main, WRITE: SSLv2 client hello message, length = 98
[Raw write]: length = 100
0000: 80 62 01 03 01 00 39 00 00 00 20 00 00 04 01 00 .b....9... .....
0010: 80 00 00 05 00 00 2F 00 00 33 00 00 32 00 00 0A ....../..3..2...
0020: 07 00 C0 00 00 16 00 00 13 00 00 09 06 00 40 00 ..............@.
0030: 00 15 00 00 12 00 00 03 02 00 80 00 00 08 00 00 ................
0040: 14 00 00 11 48 C9 21 89 C9 8F 21 47 23 94 BA 7C ....H.!...!G#...
0050: 10 96 B4 B9 84 BD FF 58 58 23 3E 81 54 08 4F 4E .......XX#>.T.ON
0060: 91 9C 59 A7 ..Y.
main, received EOFException: error
main, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
main, SEND TLSv1 ALERT: fatal, description = handshake_failure
main, WRITE: TLSv1 Alert, length = 2
[Raw write]: length = 7
0000: 15 03 01 00 02 02 28 ......(
main, called closeSocket()




Client code:
public class TestClnt {

private static final String host = HOST;
private static final int port = 1242;

public static void main(String[] args){
System.setProperty("javax.net.ssl.trustStore","Client_Truststore");
System.setProperty("javax.net.ssl.trustStorePassword","password");
System.setProperty("security.provider.3","com.sun.net.ssl.internal.ssl.Provider");
System.setProperty("javax.net.debug","all");
System.setProperty("java.security.policy","java.policy");

TestS serv = null;
try{

Registry registry = LocateRegistry.getRegistry(
host, port,
new SslRMIClientSocketFactory());
serv = (TestS) registry.lookup("TestSrv");
if(serv != null){
System.out.println("Server is up");
System.out.println(serv.getMessage());
}
}catch(Exception e){
System.out.println("ERROR!!");
e.printStackTrace();
}


}

}

Please help me
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 24 2008
Added on Sep 11 2008
9 comments
3,339 views