Friday, May 8, 2020

Generate a Certificate file and Private Key


   Generate a Certificate file and Private Key

An example of how to create a certificate:


1.   keytool -keysize 2048 -genkey -alias mycert -keyalg RSA -keystore ./mycert.jks

2.   keytool -importkeystore -srckeystore mycert.jks -destkeystore mycert.p12 -deststoretype PKCS12

3.  openssl pkcs12 -in mycert.p12 -out key.pem -nocerts –nodes

4.  keytool -export -alias mycert -file mycert.crt -keystore mycert.jks -rfc


If you don't have openssl installed click on below link and download now.


You will get one executable file, click on it and follow the wizard steps until you finish it.


Add openssl to your environment variables.My system path settings are as below. Follow the same in your system as well.

System variable settings:


bin folder path should be given in the environment path variable.


User variable settings.



OPENSSL_CONF=yourpath/openssl.cfg

Once these settings are done, go back to the cmd and type openssl. You should see >OpenSSL as output. If the settings are incorrect, you will get error message.

KeyTool.

Keytool is part of your Jave JDK. go to the path of keytool and run the keytool commands, you don't need to do anything special for keytool.











c

























No comments:

Post a Comment