Thursday, December 13, 2007

Signing a Jar

The steps to sign a jar are as follows:

#javac *.java
#jar -cvf cupidIM.jar *.*
#keytool -genkey -keyalg RSA -keystore test_store -alias rsatest
#keytool -export -alias rsatest -file rsatest.cer -keystore test_store
#keytool -import -alias rsatest -file rsatest.cer -keystore cacerts
#jarsigner -keystore test_store cupidIM.jar rsatest

1 comment:

  1. If one forgets the password used while creating the keystore then the keystore file should be deleted and again a new keystore needs to be created.

    A keystore is created whenever you use a -genkey, -import, or -identitydb command to add data to a keystore that doesn't yet exist.

    But what if the -keystore option is not specified while creating the keystore. In that case you will not aware of the location where keystore file is stored.

    The keystore is by default stored in a file named .keystore in the user's home directory, as determined by the user.home system property. If that file does not yet exist, it will be created.

    It's a good practice to use -keystore option for specifying the name and location of the persistent keystore file.

    Below link mention all these concepts along with the steps required while using the Signed Certificates obtained from the Certification Authority (CA) like VeriSign, Thawte, Entrust etc...

    Code Signing In Java