Signing a JAR File

To make use of permissions granted to a particular signer, you need to know how to sign code. This is done by signing JAR files. If you already know how to manipulate the key store, which you have seen over the past few chapters, signing a JAR file is a piece of cake. You just type the following:

jarsigner jarfile alias
					

The jarfile parameter is, of course, the name of the JAR file you want to sign and alias is the alias for a key in the key store that you will use to sign the JAR file. In case you don't remember how to create a key, just type the following:

keytool -genkey -alias somekeyalias
					

This generates a new key for signing code and gives it the specified alias. Now, if you want to distribute the code to other users, ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.