I've generated a self-signed certificate using the following command:
subj="/C=US/ST=Denial/L=Home/O=Student/CN=data.com"
# -nodes flag provides no passphrase entry
openssl req \
-x509 \
-nodes \
-days 365 \
-newkey rsa:2048 \
-keyout privateKey.key \
-out certificate.crt \
-subj "$subj"
However, I'm not finding any good examples that show how to use the file certificate.crt with an Undertow.io Web server. I'd like to use the certificate to create an SSLContext with which I can then use addHttpsListener
from the Undertow api.
I've dug around reading up on TrustManagers and KeyStores, but I haven't been able to find the right steps to add this certificate to the server to then serve Https. What are the right steps to create an Https server with undertow using this self-signed certificate?
Update I intend not to deploy this this with WildFly. It's intended as a an executable jar standing up the server from a 'main' via the command-line. (A bit more complicated than that, but there will be no xml).