Sunday, June 10, 2012

JDK Keytool for importing certificates to keystore

Keystore is a Certificate and Key management tools that comes with JDK. Keytool stores Key and Certificate in keystore.

The following shows commonly used commands with Keystore. I found the following Keytool commands handy and very useful.

Changing Alias Of Existing Certificate in Keystore (keystore.javaexpblog ).

keytool -changealias -srcalias https -destalias sidd-https -keystore keystore.javaexpblog  -storepass mykeypassword.

List all the certificates In a Keystore (keystore.javaexpblog).
keytool -list -keystore keystore.javaexpblog -storepass mykeypassword.

See Details of Certificate with alias https
keytool -list -keystore keystore.javaexpblog -storepass mykeypassword -v -alias https.

Deleting Certificate from Keystore
sudo keytool -delete -alias sidd-e2 -keystore keystore.javaexpblog -storepass mykeypassword

Importing New Cert (certificate_2.cer) To Existing Keystore
keytool -import -trustcacerts -keystore keystore.javaexpblog -alias sidd-e2 -storepass mykeypassword -file certificate_2.cer

No comments :

Post a Comment