title: IP address as hostname (CN) when creating a certificate? (HTTPS hostname wrong: should be <ipAddress>)
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/8443081/how-are-ssl-certificate-server-names-resolved-can-i-add-alternative-names-using">How are SSL certificate server names resolved/Can I add alternative names using keytool?</a>  </p>
  </blockquote>
  
  
  
  <p>I created a certificate and set the CN to the IP address of my server which is in xxx.xxx.xxx.xxx format. But when I try to run my code in Java, I'm getting a <code>HTTPS hostname wrong:  should be &lt;xxx.xxx.xxx.xx></code> error message.</p>
  
  <p>What could be wrong? I'm sure that I'm connecting to the correct IP address. However, I did not specify the port of the server on the certificate. Is the port required when supplying the value for CN? But I'm using the default port for https which is 8443. Also, I tried changing my CN from the IP address of my server to "localhost". It works after that. I'm thinking if the CN part does not accept an IP address as value?</p>
  
  <p>Can you please explain how the CN works and what are the required value for it?</p>
  
  <p>Thanks!</p>