Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Hostname in SSL Handshake (SNI) in JDK 1.7.x

Tags:

java

ssl

sni

JDK 1.8 seems to be providing the following option to explicitly set Hostname for connecting to SNI enabled sites,

    SNIHostName serverName = new SNIHostName("www.example.com");
    List<SNIServerName> serverNames = new ArrayList<>(1);
    serverNames.add(serverName);
    sslParameters.setServerNames(serverNames);

Is there any similar way to do in JDK 1.7. I have already set jsse.enableSNIExtension=true. I need to explicitly set hostname. Any help is much appreciated.

like image 428
Janaki Sathiyamurthy Avatar asked Feb 24 '15 05:02

Janaki Sathiyamurthy


1 Answers

There is no way to set SNIHostName in Java 7. We can set using Java 8 only.

You can refer to below URL for more details. http://javabreaks.blogspot.com/2015/12/java-ssl-handshake-with-server-name.html

like image 70
CrackTheLogic Avatar answered Nov 10 '22 07:11

CrackTheLogic