Thursday, July 10, 2008

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.


wsas6

3 comments:

Anonymous said...

HELP! When I try to run: 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

This is what I get:
keytool is not recognized!!!!!

Prabath said...

keytool comes with JDK - make sure you set the Env variable PATH to C:\Program Files\Java\jdk1.5.0_06\bin.

You should find keytool at C:\Program Files\Java\jdk1.5.0_06\bin

Thanks.
- Prabath

anonymous said...

im using wso2wsas v3.0........i successfully added the key store by following the steps mentioned here (http://blog.facilelogin.com/2008/07/exporting-keystore-private-key-with.html)..but im not able to click on the rpkeystore.jks after adding it and hence unable to get the server.key.........

any help..

cheers,
arun