I used this example of server and client class:
Then I used the following commands:
keytool -genkey -alias my_a -keystore server.jks
keytool -export -keystore herong.jks -alias my_a -file my_a.crt
keytool -import -keystore public.jks -alias my_home -file my_a.crt
Then I don’t know what to do. I use Eclipse and I don’t know how to work with certificates in it.
P.S. Or maybe someone can give me a better solution to the problem?
You need to tell the JVM about any key and truststores. Do a search on the properties javax.net.ssl.trustStore, javax.net.ssl.trustStorePassword, javax.net.ssl.keyStore, javax.net.ssl.keyStorePassword