I want to secure comunication in my application using SSL. I am using org.apache.commons.ssl and OpenSSL. I have created key and crt like this (those are self signed for now):
openssl req -new -x509 -nodes -out szrr.crt -keyout szrr.key
openssl rsa -des3 -in szrr.key -out szrr.key.new
del szrr.key
move szrr.key.new szrr.key
So i have now key and cert which i use this way:
KeyMaterial km = new KeyMaterial(certChain, key, password);
SSLServer sslServer = new SSLServer();
sslServer.setKeyMaterial(km);
sslServer.addTrustMaterial(TrustMaterial.TRUST_ALL);
sslServerSocket = (SSLServerSocket) sslServer
.createServerSocket(serverPort);
certChain, key are paths to crt and key, password is just password 🙂
Now what else do I have to do to create SSLClient similar way?
Check the example below: