Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Key Steps

  1. Create a new Keystore.

  2. Empty the Keystore.

  3. Verify if the Keystore is empty.

  4. Import the P12 file.

  5. Check the Keystore is non-empty.

  6. Change the alias, if needed.

  7. Verify a new alias.

To perform the above steps, open a Command Prompt window. The steps along with the requisite syntax are described in detail below:

Anchor
Step-1

...

...

Step-1

Step 1 -

...

Create New Keystore

  •  Execute the following command at the Command Prompt

...

Note

The same key password will be used in the subsequent steps.

Anchor
Step-2

...

...

Step-2

Step 2 -

...

Empty the Keystore

  • 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.

Anchor
Step

...

-3
Step-3

Step 3 -

...

 Verify if Keystore is Empty

  • 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".

Anchor
Step-4

...

Step-4

Step 4 -

...

 Import the P12 file

  • 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 Keystore is ready with one entry having a private key imported from the P12 file. The alias for that private key is privatekey.

Info

Steps 6 & 7 are needed if you want to change the alias for the imported private key.

Anchor
Step-6
Step-6

Step 6 - Change Alias if needed

...

Insert excerpt
XYZ Snap Pack
XYZ Snap Pack

...