Exporting keystore private key with WSAS

Java keytool does not come up with an easy way of exporting keystore private key.

Following is an alternative way you can do it with WSAS.

First download WSAS from here.

Now, we need to create a keystore.

keytool -genkey -alias rpcert -keyalg RSA -keysize 1024 -dname "CN=identity-rp,L=SL,S=WS,C=LK" -keypass wso2key -keystore rpkeystore.jks -storepass wso2key

The above will create a keystore with the name rpkeystore.jks having wso2key as the keystore password and wso2key as the private key password.

Now, lets see how we can export our private key from the keystore just created, with WSAS.

1. Start WSAS and type https://localhost:9443 on your brower and sigin with admin/admin [user/password].

[WSAS_HOME]\bin\wso2wsas.bat

2. View available keystores

3. Upload your keystore [just created] - keystore password : wso2key

4. Private key password: wso2key

5. Click to finish

6. Click on the keystore rpkeystore.jks

7. Copy and paste your private key to a new file called server.key and that is your exported private key from the keystore.