Download the JDK
Search the Tutorials
Hide the TOC
Trail: Security Features in Java SE
Lesson: Signing Code and Granting It Permissions
Signing Code and Granting It Permissions
Steps for the Code Signer
Download and Try the Sample Application
Create a JAR File Containing the Class File
Generate Keys
Sign the JAR File
Export the Public Key Certificate
Steps for the Code Receiver
Observe the Restricted Application
Import the Certificate as a Trusted Certificate
Set Up a Policy File to Grant the Required Permission
Start Policy Tool
Specify the Keystore
Add a Policy Entry with a SignedBy Alias
Save the Policy File
See the Policy File Effects
Home Page > Security Features in Java SE > Signing Code and Granting It Permissions
Steps for the Code Signer

> The code signer takes the following steps:

> 1. Download and Try the Sample Application.

> 2. Create a JAR File Containing the Class File, using the `jar` tool.

> 3. Generate Keys (if they don't already exist), using the `keytool` `-genkey` command.

>    Optional Step Generate a certificate signing request (CSR) for the public key certificate, and import the response from the certification authority (CA). For simplicity (and since you are only pretending to be Susan Jones), this step is omitted. See Generating a Certificate Signing Request (CSR) for a Public Key Certificate for more information.

> 4. Sign the JAR File, using the `jarsigner` tool and the private key.

> 5. Export the Public Key Certificate, using the `keytool` `-export` command. Then supply the signed JAR file and the certificate to the receiver Ray.

> These steps are shown in the following figure.

> This figure has been reduced to fit on the page.
> Click the image to view it at its natural size.

Previous page: Signing Code and Granting It Permissions
Next page: Download and Try the Sample Application