RIM SignatureToolRunner

Have you ever tried to sign Java applications for Blackberry devices? It's a real pain.
RIM ships the JDE (Java Development Environment) with a tool to sign JAR files, but there is a number of shortcomings:

  1. One can not call the main() method of the tool, since it has a lot of calls to System.exit()
  2. One can not sign applications automically (e.g. in a build process), because there is a dialog asking for the keystore password
  3. One can not decide about the success of the signing operation by looking at the exit code, because it is 0 even if there was an error while signing the application
  4. The sigtool.csk file has to be in the same directory as the SignatureTool.jar

To solve at leaste the last 3 of these issues, I wrote a small wrapper for the SignatureTool that uses AspectJ to remove the password dialog, writes a file if the signing procedure was successful and lets you specify where your sign.csk file is located. In order to use this wrapper you have to:

  1. Download SignatureToolRunner.jar
  2. Put the original SignatureTool.jar and the AspectJ runtime libraries (aspectjrt.jar and aspectjweaver.jar) in the same directory as SignatureToolRunner.jar
  3. Run the SignatureToolRunner.jar with the following command line:
    java -javaagent:aspectjweaver.jar -jar SignatureToolRunner.jar <PATH_TO_DIR_WITH_CSK_FILE> <KEYSTORE_PASSWORD> <ARGS_FOR_SIGNING_TOOL...>

If you use the command line switches -a -c and the name of the .cod file you can sign applications fully automated. After a successful signing the SignatureToolRunner creates a file called signing_result.txt in its working directory.

The SignatureToolRunner has been tested with JDK 1.6, AspectJ 1.5.3 and JDE 4.2.0. It probably works with other versions too, but its up to you to give it a try.

The source code is available here: SignatureToolRunnerSource.zip.

If you have any questions send an email to signaturetoolrunner [at] cive.de.

Return to project index

Return to cive.de

Imprint (in german)

Valid XHTML 1.0 Strict