Signing an Applet with a Batch File

Here’s a short and simple way of signing an Java applet (on Windows) if you already have a keystore file (e.g. a pfx file9 with the key for signing

Put these manifest attributes into a text file named manifestadditions.txt

Permissions: sandbox
Codebase: your.app.com
Application-Name: YourApp

(for the permissions to work, add the permissions parameter to the html code where you embed the applet:

<param name="permissions" value="sandbox" />

, you might also need to add a corresponding permissions attribute on the applet’s tag)

The following batch file adds these manifest entries to all jars in the current directory, and signs these jars

for %%f in (*.jar) do (
 	jar ufm %%~nf.jar manifestadditions.txt
 	jarsigner -storetype pkcs12 -storepass *yourPassword* -keystore *yourKeyStore*.pfx %%~nf.jar *yourAlias*
)

To check if the signing worked, run jarsigner -verify *yourJar*

This entry was posted in Software. Bookmark the permalink.