Download the JDK
Search the Tutorials
Hide the TOC
Trail: Security Features in Java SE
Lesson: Signing Code and Granting It Permissions
Section: Steps for the Code Receiver
Subsection: Set Up a Policy File to Grant the Required Permission
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
Start Policy Tool

> To start Policy Tool, simply type the following at the command line:

> >     policytool

> This brings up the Policy Tool window. Whenever Policy Tool is started, it tries to fill in this window with policy information from what is sometimes referred to as the "user policy file," which by default is a file named `.java.policy` in your home directory. If Policy Tool cannot find the user policy file, it reports the situation and displays a blank Policy Tool window (that is, a window with headings and buttons but no data in it, as 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.

> You will create and work on a policy file other than the user policy file, since the lessons of this trail don't expect modifications to be made to your official user policy file.

> Assuming that you see the blank Policy Tool window (if not, select New in the File menu), you can immediately proceed to create a new policy file.

Previous page: Set Up a Policy File to Grant the Required Permission
Next page: Specify the Keystore