Why should I sign my JAR files?

The short answer – don’t, unless your company policy forces you to.

The long answer
Signing jars is effectively telling your customer “I made this, and I guarantee it won’t mess up your system. If it does, come to me for retribution”. This is why signed jars in client-side solution deployed from remote servers (applets / webstart) enjoy higher privileges than non-signed solutions do.

On server-side solutions, where you don’t have to to placate the JVM security demands, this guarantee is only for your customer peace of mind.
The bad thing about signed jars is that they load slower than unsigned jars. How much slower? it’s CPU-bound, but I’ve noticed more than a 100% increase in loading time. Also, patches are harder (you have to re-sign the jar), class-patches are impossible (all classes in a single package must have the same signature source) and splitting jars becomes a chore. Not to mention your build process is longer, and that proper certificates cost money (self-signed is next to useless).

So, unless your company policy forces you to, don’t sign jars on the server side, and keep common jars in signed and non-signed versions (signed go to the client-side deployment, non-signed go to server-side codebase).

Leave a Comment