Being obsessive and all, I decided to sit down and figure out why the signature tool doesn’t seem to work in Linux. After all it’s a rather trivial Java application. I suspected from the start that the symptom was some sloppy programming on RIM’s part, hard coding Windows style path names and my suspicion was correct. After modifying two class files and reassembling SignatureTool.jar the signature tool worked like a charm!
I don’t know what the legality is regarding redistribution of RIM’s development tools, specifically ones that have been modified so what follows is a description of the steps required to modify SignatureTool.jar to work in a Unix style file system (forward slash for directory separators).
Get SignatureTool.jar and extract it
It goes without saying that you will need the Java Runtime installed before starting. I would recommend the Sun JRE. In Ubuntu, you can install this by running
sudo apt-get sun-java5-jre
Grab a copy of the SignatureTool.jar and put it somewhere along with your .csk and .db files. I am using SignatureTool.jar from version 4.3 of the JDE. The remainder of this guide might be specific to this version as I will be editing constants and referring to them by index numbers.
Extract the SignatureTool.jar file into a temporary directory:
jar -xf SignatureTool.jar -C tmp
Editing the class files
Now I tried using a hex editor and a decompiler but by far the easiest method was to use a program called ClassEditor to modify the two files in question. Download the binary release and extract it, and run it with the command:
java -jar ce.jar
Open two class files extracted earlier: q.class and ad.class. ClassEditor will look something like this:
Start with q.class and select the Constant Pool tab. In this file we need to change string constants containing just a single backslash character. There are actually two constants in the pool but the first is just a reference to the second. The string we want is at index 223.
By default ClassEditor starts in read only mode so click the bright green Modify Mode(Off) button in the top right. The fields in the details area are now editable. Simply change the forward slash to a backslash and click Modify. Click save and that’s it for q.class!
Select ad.class on left and locate constant 117, again in the Constant Pool tab.
Change the value from \sigtool.set to /sigtool.set and click Modify. Click save and that’s it for ad.class.
Repack SignatureTool.jar and test
To repack SignatureTool.jar just cd to the temporary directory where you extracted the jar and rejar the class files
jar -cmf META-INF/MANIFEST.MF ../SignatureTool.jar *
Go up one directory and remove the temp directory
rm -rf tmp
To test that everything worked, just run the command
java -jar SignatureTool.jar
If should prompt you to locate a cod file. Just cancel this and click the Properties button in the main signature tool window. If you see a list of Registered Signers it worked!
RIM are you listening?
At the off chance that someone from RIM is reading this, please forward this to whoever maintains this tool:
- Locate class containing the string “\sigtool.set”
- Change to java.io.File.separator + “sigtool.set”
- Locate class containing the strings “\\” + “sigtool.db”
- Change to java.io.File.separator + “sigtool.db”
- Locate class containing the strings “\\” + “sigtool.csk”
- Change to java.io.File.separator + “sigtool.csk”