How to Generate a CSR on JBoss Server?
Certificate Signing Request (CSR) is a necessary step in acquiring an SSL/TLS certificate for securing applications running on JBoss servers. CSR holds your server’s public key and organizational details, which are used by a Certificate Authority (CA) to issue a trusted SSL certificate.
This tutorial will take you through the basic process of creating a CSR on a JBoss Server using Java’s keytool utility.
Prerequisites
Before starting the keytool process, be sure you have the following installed and operational:
- JBoss Server is installed and running
- Java Development Kit (JDK installed – Java Development Kit includes keytool)
- Administrative/root account on the server
- A fully qualified domain name (FQDN) of your application
- Access to create and store a keystore file on disk
- An understanding of basic command-line functionality
CSR Creation on a JBoss Server
Step 1: Create a Keystore and Private Key
The first step in this process is to create the keystore for your JBoss Server. Keystores are used to house the private key that is associated with your JBoss Server.
- To generate the keystore and the private key, use the following keytool command:
keytool -genkey -alias create_Privatekey_Alias -keyalg RSA -keystore path_and_create_KeystoreFilename.jks -keysize 2048
- You must define an alias for your private key that will be used to create the CSR (Certificate Signing Request) and to install the certificate; this alias must be remembered.
- You must also create a password for the keystore. You will need to provide this password again for confirmation, and you should save it (either on paper or on your PC) as you will need it to configure the certificate.
- Enter your contact information in the format outlined below:
- Your first name and last name (Common Name (CN)): The Fully Qualified Domain Name (FQDN) of the site that needs to be secured, for example: www.yoursite.com. If you’re obtaining a Wildcard Certificate, include an asterisk (*) just prior to your domain name; in this case, it would be, *.yoursite.com.
- Organisational Unit (OU): This field has been deprecated; just press Enter when you’re prompted to input this Information.
- Name of your Organisation (O): Enter the legal name of your business, e.g., Your Company LLC. If you’re applying for DV (Domain Validated) Certificates, this field should be left blank by pressing Enter.
- To confirm your submission, review the information that you entered and type Y followed by pressing the Enter key.
- To submit an Alias, please enter the password that corresponds to that Alias. The command will then prompt you for a private key password.
- Press the Enter key.
Your Private Key and Keystore Passwords are the same. Do not lose them! The password for your keystore and private key is the same and, therefore, should be preserved.
Step 2: Creating the CSR from the keystore
Execute the command shown here:
keytool -certreq -keyalg RSA -alias your_privatekey_alias -file your_csr_file.csr -keystore your_keystore_filename.jks
- Save a backup copy of your keystore file because it will be required during the installation procedure.
- After creating the CSR (.csr) file, open your CSR (.csr) file with a text editor like Notepad. Select and copy the entire contents of the CSR into your SSL certificate order form.
Depending on your certificate type, it might take from several minutes (for DV certs) to several business days (for EV and OV certs) before you receive your certificate in your email.
Next Step: How to Install an SSL Certificate in JBoss?
Conclusion
Producing a CSR through the JBoss Server is a relatively easy but important part of applying Security / SSL/TLS to your application.
While generating the keystore, the private key and CSR (using “keytool”) allow you to demonstrate your server identity to any authorized Certificate Authority that can then validate that identity.
If it is successful, provide you with your certificate to complete a secure, private HTTPS connection to your application, protecting the confidentiality of the information you are transferring.