Forums

Help

Exe is not working after signing with SignToo

I have created a Java application &amp; bundled it in Jar file.
After that I have create exe with JSmooth &amp; signed it. Its working perfectly fine. But now I want to switch from Jsmooth to Launch4j, this also creating exe like Jsmooth. The exe is working fine, but after signing with Signtool, its shows me error about INVALID Jar. So what should I do ?

Actually, it is possible to sign a wrapped jar file with a little bit of work.
The final file format will be the header+jar+footer where the header is the launch4j.exe, the jar is really just a zip, and the footer is the signtool authenticode signature.
Since the zip format allows for a comment to be included at the end of the central directory record, up to 65535 bytes can occur after the jar which should be enough for the signature.
Steps to perform:
1. Use launch4j to wrap test.jar to test.exe
2. Create a copy of test.exe named test-sign.exe
3. Use signtool to sign test-sign.exe
4. Find the size of the signature in bytes i.e. sizeInBytesOf(test-sign.exe) - sizeInBytesOf(test.exe)
5. Edit test.exe with favorite HEX editor to change last two bytes of exe i.e. the jar i.e. the zip end of central directory to the size using littleendian byte order and save
6. Use signtool to sign test.exe
7. Verify test.exe signature