I am trying to test a SSL server and want to check whether a particular cipher is supported by the SSL server or not.
For that I am using following command = openssl s_client -connect google.com:443 -cipher RC4-SHA
and invoking it from Java program as below and works pretty well, except for the fact that my Java program never exits because the openssl
process started is still ON.
Process process = Runtime.getRuntime().exec("openssl s_client -connect google.com:443");
System.out.println("Waiting for process to terminate ...");
process.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = "";
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
System.out.println("Exiting ...");
I see there is something like openssl s_client -connect google.com:443 -verify 0
but this is error return code and doesn't fetch the information I am looking for, however it do stops the openssl
process.
Is there any way to exit the openssl connect once client-server handshake is completed?