DEV Community

loading...

Important keytool commands to work with keystores and truststores

Dhanushka madushan
Passionated geek in computer engineering
・1 min read

Generate Keystore

keytool -genkey -alias alice -keyalg RSA -keysize 2048 -keystore interop2.jks -dname "CN=Alice, OU=Wso2, O=Wso2, L=Wso2, ST=Wso2, C=LK" -storepass password -keypass password
Enter fullscreen mode Exit fullscreen mode

View Keystore details

keytool -v -list -keystore interop2.jks
Enter fullscreen mode Exit fullscreen mode

Export certificate from Keystore

keytool -export -alias alice -keystore interop2.jks -file interop2alice.pem
Enter fullscreen mode Exit fullscreen mode

Import certificates to Truststore

keytool -import -alias alice -file interop2alice.pem -keystore sts.jks -storepass password
Enter fullscreen mode Exit fullscreen mode

Discussion (0)