I’m using openssl to create self-signed certs. I’m getting this error with the certs I generated:
javax.net.ssl.SSLHandshakeException:
java.security.cert.CertificateException: No subject alternative names
present
Does anyone know how to specify “Subject alternative name” while creating a cert?
This is how I’m generating a keystore:
sudo $JAVA_HOME/bin/keytool -genkey -dname "CN=192.168.x.xxx, OU=I, O=I, L=T, ST=On, C=CA" -alias tomcat -validity 3650 -keyalg RSA -keystore /root/.keystore -keypass abcd -storepass abcd
To generate a key:
openssl s_client -connect 192.168.x.xxx:8443 2>/dev/null
Please help! Thanks!
Although this question was more specifically about IP addresses in Subject Alt. Names, the commands are similar (using
DNSentries for a host name andIPentries for IP addresses).To quote myself:
Note that you only need Java 7’s
keytoolto use this command. Once you’ve prepared your keystore, it should work with previous versions of Java.(The rest of this answer also mentions how to do this with OpenSSL, but it doesn’t seem to be what you’re using.)