Create Keystore Certificate and Export Public Key


This article describes the step-by-step process of creating Java Keystore Server certificate and exporting the Public Key certificate generated in the keystore.


  • Install JDK 8 
  • Install OpenSSL


How to create Java Keystore Server certificate and export the Public Key generated in the keystore.


    1. Nagivate to OpenSSL installed directory, In Windows go to the below path

         C:\Program Files\OpenSSL-Win64\bin


    2. Open Command Prompt and Run as Administrator, navigate to the OpenSSL path


    3. Copy the below command to create the keystore file and enter to run it

          keytool -genkey -v -alias 1 -keyalg RSA -keystore kstore.jks


    4. Enter keystore password and make a note of it


    5. Enter Name, Organization, Country code & other details and enter "yes" to confirm the details


    6. Once details confirmed and password entered for keystore alias, it generates the keystore file in the same OpenSSL directory



    7. Run the below command to export the public key certificate

           keytool -export -alias 1 -keystore kstore.jks -file certificate.crt


    8. Enter the keystore password which was noted earlier and then public key certificate gets generated in the same OpenSSL directory