Question

I'm trying to use either the command-line jarsigner or the ant signjar task to self-sign an applet. I'm finding that both jarsigner and signjar overwrite the maniftest.mf file containing necessary Codebase and Permissions entries, so that when the applet runs it fails because of those missing entries. I've tried adding the necessary entries after signing but that causes the applet to fail to load, I assume meaning that these Codebase and Permissions entries also must be signed. Same results on Mac or Win with JDK 1.7.0_40 or 1.6.0_51.

I'm sure this is user error, or the internet would be alight with questions and complaints. I've searched for this issue without finding a working solution. Have any of you encountered and solved this seeming catch-22? Appreciate your help!

Was it helpful?

Solution

Answering my own question, in case someone with a similar puzzle arrives here via Google.

I'd been using the ant manifest task to create my manifest.mf file dynamically. That is, no physical filesystem file named "manifest.mf". This task adds a manifest.mf file to JARs packaged by ant with no problem, but somehow, and I don't know why, there's an unhappy interaction between a manifest created this way and the jarsigner tools, including the ant signjar task. If I create a physical manifest.mf file on the file system, have the jar task include that file in the .jar, then sign via signjar, all is well.

I don't know if this should be considered a bug in the manifest task, or if I was simply doing it wrong. I do know that rolling my own manifest.mf file by hand is working correctly.

I hope this helps someone in future!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top