...
Importing P12 File
Anchor | ||||
---|---|---|---|---|
|
Key Steps
To perform the above steps, open a Command Prompt window. The steps along with the requisite syntax are described in detail below:
Step 1 - Create New Keystore
Anchor | ||||
---|---|---|---|---|
|
Execute the following command at the Command Prompt
...
Note |
---|
The same key password will be used in the subsequent steps. |
Step 2 - Empty the Keystore
Anchor | ||||
---|---|---|---|---|
|
Execute the following command at the Command Prompt:
Code Block keytool -delete -alias <alias name> -keystore <keystore name> Example: keytool -delete -alias demoalias1 -keystore demokeystore1
Enter the password as given in Step 1.
Step 3 - Verify if Keystore is Empty
Anchor | ||||
---|---|---|---|---|
|
Execute the following command at the Command Prompt:
Code Block keytool -v -list -keystore <keystre name> Example: keytool -v -list -keystore demokeystore1
Enter password as given in Step 1.
The response should be "Your keystore contains 0 entries".
Step 4 - Import the P12 file
Anchor | ||||
---|---|---|---|---|
|
Execute the following command at the Command Prompt:
Code Block keytool -v -importkeystore -srckeystore <p12file.p12> -srcstoretype PKCS12 -destkeystore <keystore name> -deststoretype JKS -destkeypass <password for private key (should be same as keystore passphrase)> Example: keytool -v -importkeystore -srckeystore sample_p12_file.p12 -srcstoretype PKCS12 -destkeystore demokeystore1 -deststoretype JKS -destkeypass demoPassword1
Enter the destination Keystore password given in Step 1.
Enter the source Keystore password that was obtained while generating P12 file.
The response should be "Import command completed: 1 entries successfully imported, 0 entries failed or canceled".
Step 5 - Check Keystore to be Non-empty
Anchor | ||||
---|---|---|---|---|
|
Execute the following command at the Command Prompt:
Code Block keytool -v -list -keystore <keystre name> Example: keytool -v -list -keystore demokeystore1
Enter password as given in Step 1.
...
Steps 6 & 7 are needed if you want to change the alias for the imported private key.
Step 6 - Change Alias if needed
Anchor | ||||
---|---|---|---|---|
|
Execute the following command at the Command Prompt:
...
The response will be blank if the change is successful.
Step 7 - Verify New Alias
Anchor | ||||
---|---|---|---|---|
|
Repeat Step 5 and ensure the alias name is what is given in Step 6.
...