Tuesday, December 26, 2017

Java Keytool Comands

Java Keytool is useful tool for managing the certificates. It allows users to manage their own public/private key pairs and certificates. Below commands will be used when working on keytool.

Create a JKS file with a private certificate.
 keytool -genkey -alias nuwanw -keyalg RSA -keysize 1024 -keypass mypassoword  
 -keystore sample.jks -storepass mypassword  

List the alias of a given keystore
 keytool -list -v -keystore sample.jks -storepass mypassword  

Export public certificate of the service alies nuwanw
 keytool -export -alias nuwanw -keystore sample.jks -storepass mypassword   
 -file publicCert.pem  

Import public certificate into a Trust Store.
 keytool -import -alias nuwanw -file serviceCert.pem -keystore sample-trust-store.jks   
 -storepass mypassword  


No comments:

Post a Comment