Skip to content
Advertisement

Certificate subject for doesn’t contain a common name and does not have alternative names

I have generated a SSL self-signed certificate using the following commands one-by-one in remote ubuntu machine via terminal:

openssl genrsa -aes256 -passout pass:gsahdg -out server.pass.key 4096
openssl rsa -passin pass:gsahdg -in server.pass.key -out server.key
rm server.pass.key
openssl req -new -key server.key -out server.csr (in this step, provided the Common Name)
openssl x509 -signkey server.key -in server.csr -req -days 358000 -out server.crt
openssl pkcs12 -export -out certificate.pfx -inkey server.key -in server.crt

T I’ve added the server.crt onto my local machine’s cacerts using keytool in command prompt as admin. Also added the server.crt onto ‘Trusted Root Certification Authorities’. he issue is that HTTPS request to the remote ubuntu machine server on Postman works fine but not on IntelliJ with rest-assured as I’m getting:

javax.net.ssl.SSLException: Certificate subject for doesn’t contain a common name and does not have alternative names

Answer

I’ve recreated the .crt & .pfx with common name as remote ubuntu machine ip address and configured the same certificate in the app running. Now that issue has been eradicated.

Advertisement