Create a keystore using OpenSSL
search cancel

Create a keystore using OpenSSL

book

Article ID: 136370

calendar_today

Updated On:

Products

Service Virtualization

Issue/Introduction

Have the private key and the certificate and need to create a keystore to be used with the tool.

Environment

All supported DevTest releases.

Cause

N/A

Resolution

Will need to have OpenSSL and Keytool available on your machine.
1. Open a command prompt and CD to the path where OpenSSL executable is available.
2. To create the p12 file run the following command: 
     openssl pkcs12 -export -in CertPath.cer -inkey privateKeyPath.key -out key.p12 

3. CD to the path where Keytool is available.
4. To verify the alias of the private key run the following: 
     keytool -v -list -storetype pkcs12 -keystore key.p12 

Look for alias and its value. It will be used in the next step.

5. To convert the p12 file to JKS run the following: 
    keytool -importkeystore -srckeystore [MY_FILE.p12] -srcstoretype pkcs12 -srcalias [ALIAS_SRC] -destkeystore [MY_KEYSTORE.jks] -deststoretype jks -deststorepass [PASSWORD_JKS] -destalias [ALIAS_DEST]

Where MY_FILE.p12 is the keystore file created in step 1.
ALIAS_SRC is the alias verified in step 4.
MY_KEYSTORE.jks is the name of the keystore that will be created.
PASSWORD_JKS is the password you want to set for the new keystore.
ALIAS_DEST is the alias that will be set in the new keystore.