Monday, August 13, 2018

Create csr file using java keytool and install certificate in java trusttstore

1.First open a command prompt (if using Windows, open the command prompt as an administrator) and navigate to your <JDK_HOME>\bin directory. Once there, generate the key store and private key using the command below.
1


keytool -genkey -alias <store name> -keyalg RSA -keysize 2048 -sigalg MD5withRSA -keypass <password> -keystore <store name>.jks -storepass <password>

Where <store name> is the name of the key store you want to use, <password> is the password you wish to use. You will be prompted to enter some additional information like below.

This command will generate blank jks file in your <JDK_HOME>\bin directory.

2.Next you need to generate the CSR which can be used to download your certificate. Use the command below.
keytool -certreq -v -alias <store name> -sigalg MD5withRSA -file YYYY.csr -keypass <password> -storepass <password> -keystore <store name>.jks

Where <store name> is the name of the key store you want to use, <password> is the password you wish to use. You can open the CSR file using a text editor/viewer. Use the same <store name > and <password> used in step #1.


3.Install the trusted root CA certificate to the Java Key Store using the command below:
keytool -import -v -noprompt -trustcacerts -alias <store name> –file XXX.cer -keystore <store name>.jks -storepass <password>

No comments:

Post a Comment

How to check whether operating system is 64 bit or 32bit?

What is 32 and 64 bit operating system? The terms 32-bit and 64-bit refer to the way a computer's processor that is CPU, handles info...