# Generate private key
openssl genrsa -out wildfly-ssl.key 2048
# Generate CSR
openssl req -new -key wildfly-ssl.key -out wildfly-ssl.csr
# Generate Self Signed cert
openssl x509 -req -days 365 -in wildfly-ssl.csr -signkey wildfly-ssl.key -out wildfly-ssl.crt
# Generate PKCS12 file with cert and key
openssl pkcs12 -export -in wildfly-ssl.crt -inkey wildfly-ssl.key -out wildfly-ssl-cert-with-key.p12
# Import cert and key into keystore
keytool -importkeystore -deststorepass _password_ -destkeypass _password_ -destkeystore wildfly-ssl.keystore -srckeystore wildfly-ssl-cert-with-key.p12 -srcstoretype PKCS12 -srcstorepass _password_
# Copy the files to the correct locations
cp wildfly-ssl.crt /etc/pki/tls/certs
cp wildfly-ssl.key /etc/pki/tls/private/wildfly-ssl.key
cp wildfly-ssl.csr /etc/pki/tls/private/wildfly-ssl.csr
Other links…
http://reallifejava.com/configuring-ssl-in-wildfly-8/