Saturday, September 27, 2008

How to create certificates using keytool?

Go to $JAVA_HOME & follow the steps mentioned below

Step 1: Creating keystore
$ keytool -genkey -keyalg RSA -sigalg MD5withRSA -keystore <keystore_name> -alias <key_name> -validity <validity_in_days>

For e.g.
keytool -genkey -keyalg RSA -sigalg MD5withRSA -keystore testkeystore -alias workflowkey -validity 7304

Step 2: Creating certificate
$ keytool -certreq -keystore <keystore_name> -alias <key_name> -storepass <password> -export -file <certificate_name>.cer

For e.g
keytool -certreq -keystore testkeystore -alias workflowkey -storepass workflow -export -file test.cer

The above command creates a certificate by name test.cer valid for 20 years

No comments:

Post a Comment