Goal: I want this url ( https://localhost:8083 ) to use my self-signed certiciate on my localmachine.
First, I referenced this url (https://gist.github.com/oslego/f13e136ffeaa6174289a) and what I did was:
$ openssl genrsa -des3 -out server.orig.key 2048
$ openssl rsa -in server.orig.key -out server.key
$ openssl req -new -key server.key -out server.csr
Country Name (2 letter code) [AU]:
...
Common Name: localhost.ssl
...
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
$ echo "127.0.0.1 localhost.ssl" | sudo tee -a /private/etc/hosts
I then convert server.crt to server.pem by executing
$ openssl x509 -in server.crt -out keystore.pem -outform PEM
$ keytool -import -trustcacerts -alias testCert -file keystore.pem -keypass testpassword -keystore keystore.jks -storepass testpassword
$ keytool -export -alias mykey -keystore keystore.jks -rfc -file truststore
$ vim keystore.password // manually created keystore.password via vim
But when I access to https://localhost:8083, it doesn't work with SSL.
Then,
I also created another certificate with
Common Name: localhost
$ echo "127.0.0.1 localhost" | sudo tee -a /private/etc/hosts
But this is not working as well. How can I make my https://localhost:8083 uses my self-signed certificate?
FYI, I use embedded Jetty and Java reads all the information correctly via config files which defines the locations of keystore.jks, truststore, and keystore.password files.