Sample INI files for Signing Java Code

This sample is located in \Samples\Security\Sign.

Description
Using the Sample
Key Project Files
Technologies Demonstrated

Description

These samples show how to use .ini files to sign Java code. A cabinet (.cab) file containing Java code may be signed with default high, medium, or low permissions using the signcode utility. Developers who want to sign their file with a set of custom permissions must use an .ini file that specifies the permissions requested.

Four .ini files have been provided: High.ini, Medium.ini, Low.ini, and Sample.ini. The high, medium, and low files list the permissions that will be used for the default cases. These are provided as examples only.

The sample.ini file enumerates the complete list of possible permissions that may be specified in an .ini file. Note that the enumerated permissions may be mutually exclusive. For example, if you specify the [FullyTrusted] permission, you do not have to specify any of the other permissions. The Sample.ini file provides a good base to create your own custom .ini file from by commenting out permissions that are not needed. To comment out a line in a .ini file, place a semicolon as the first character of the line.

For more information on signing Java code with permissions, see the Microsoft SDK for Java documentation.

Using the Sample

To run the sample

The following example shows the commands used to sign a cabinet file with the sample.ini permission file:

makecert -n "CN=My Publisher Name" -sv MyKeyName.pvk MyTestCert.cer
cert2spc MyTestCert.cer MyTestCert.spc
signcode -j javasign.dll -jp sample.ini -spc MyTestCert.spc -v MyKeyName.pvk MyApplet.cab
setreg 1 TRUE
chkjava MyApplet.cab
setreg 1 FALSE

Use these commands, replacing the italicized names with names appropriate to your files.

Key Project Files

high.ini

This file contains the settings to sign the cabinet file with high security settings.

medium.ini

This file contains the settings to sign the cabinet file with medium security settings.

low.ini

This file contains the settings to sign the cabinet file with low security settings.

sample.ini

This is an empty security settings .ini file that can be used as a template.

Technologies Demonstrated

Security

Making a certificate for signing

© 1999 Microsoft Corporation. All rights reserved. Terms of use.