ssl - Java's keytool command with IP addresses -
I'm trying to get an image through an https URL, and I'm having some problems Let's generate a main star with the keynote command if I specify the common name (cn) as my hostname, like CN = JONMORRA, and then try to query through my hostname, such that it works fine I though, if I credit my IP , Such as CN = 1 9 2.168.56.1, and try to query through my IP address, such as I should be: get an error
HTTPS hostname wrong & Lt; 192.168.56.1>
Which states that my hostname is incorrect, even if I specified in the keystore.
I would like to use an IP address instead of host names, without worrying about the hostname, I can ask questions between Linux and Windows box.
Why is CN accepting IP addresses, and how can I fix it?
Thanks
This snippet can work for you:
import javax.net.ssl.HostnameVerifier; Import javax.net.ssl.HttpsURLConnection; Import javax.net.ssl.ssl session; Hostname viewer hv = new hostname description () {verify public boolean (string urlHostName, SSL session session) {System.out.println ("Warning: url host:" + urlHostName + "vs. + + session.getPeerHost ()); Back true; }}; HttpsURLConnection.setDefaultHostnameVerifier (HV);
If you try this code, and it is not working, please urlHostName
and session.getPeerHost ()
.
Besides, why is it necessary to use the IP address instead of hostname to differentiate between Windows and Linux boxes?
Comments
Post a Comment