SHYAM RAO

Wednesday Jul 18, 2007

How to import PFX file into JKS using pkcs12import utility

The pkcs12import utility allows Public-Key Cryptography Standards version 12 (PKCS-12) files (referred to as PFX files) to be imported into a keystore, typically a keystore of type Java KeyStore (JKS).

If you have PKCS-12 formatted file, you would import this key-pair (certificate/private-key pair) into your private keystore using the pkcs12import utility. The result of the import is that the private-key and the corresponding certificate in the PKCS-12 file are stored as a key entry inside the keystore, associated with some alias.

The pkcs12import utility can be found here. Unzip the downloaded pkcs12import.zip file. pkcs12import utility can be run from the command line by executing pkcs12import.sh (on Unix systems) or pkcs12import.bat (on Windows systems). Before executing this script, make sure JAVA_HOME environment variable points to your JAVA installation.

Options for pkcs12import utility
Option
Description
-file pkcs12-file
Required. The location of the PKCS-12 file to be imported.
[ -pass pkcs12-password ]    
The password used to protect the PKCS-12 file. The user is prompted for this password if this option is omitted.
[ -keystore keystore-file ]       
Location of the keystore file into which to import the contents of the PKCS-12 file. If no value is given, defaults to ${user-home}/.keystore.
[ -storepass store-password ]   
The password of the keystore. User is prompted for the password of the truststore if this option is omitted.
[ -keypass key-password ]
The password to be used to protect the private key inside the keystore. The user is prompted for this password if this option is omitted.
[ -alias alias ]
The alias to be used to store the key entry (private key and the certificate) inside the keystore.

Calendar

Search

Links

Navigation

Referers