Csr generation java

Please enter the hostname for which you want to request a certificate:

First, you need to generate a key pair (private and public key). This is done with the following command:

keytool -genkey \
 -alias FQHN \
 -dname "CN=FQHN" \
 -keyalg RSA \
 -keysize 4096 \
 -keystore FQHN.keystore

Using this keypair, you can now create the CSR:

keytool -certreq \
 -alias FQHN \
 -file FQHN.req \
 -keystore FQHN.keystore