Im coding a client-server chat application. I want to encrypt connection between those two. Im doing that for my first time and I find it difficult. In my understanding I need a truststore for client and a keystore for server. I have followed this guide to generate them:http://peoplesofttutorial.com/generating-key-store-and-trust-store-using-keytool/
Client:
System.setProperty("javax.net.ssl.trustStore" , "hrms.truststore");
System.setProperty("javax.net.ssl.trustStorePassword" , "123456");
SSLSocketFactory sslsf = (SSLSocketFactory) SSLSocketFactory.getDefault();
SSLsocket = (SSLSocket) sslsf.createSocket(server, port);
Server:
System.setProperty("javax.net.ssl.keyStore" , "pskey.keystore");
System.setProperty("javax.net.ssl.keyStorePassword","123456");
SSLServerSocketFactory sslsocketfactory = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
sslserversocket = (SSLServerSocket) sslsocketfactory.createServerSocket(Port);
Server is starting correctly. When I connect a client which is run on the same computer as the server is then I can connect without any issues but when I connect from different computer which is on the same network I get this error: javax.net.ssl.SSLException: Received fatal alert: internal_error
Could anyone help me solve this error?