Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
 
Training Index

Help: Signing Jar files for Netscape Communicator with signtool

By MageLang Institute

Help | Solution | API Docs | Expected Output
Course Notes | Magercises | Module Intro

Help is available for each task, or you can go straight to the solution source code.



Task 1

Add Netscape's capabilities classes to your CLASSPATH.


If you place the classes in the same directory as you compile, the following command will add the package to the end of your CLASSPATH.
set CLASSPATH=
  %CLASSPATH%;capsapi_classes.zip

Task 2

Compile the program.


javac WordCount.java

Task 3

Locate your code signing certificate to sign the code.


Task 4

If you have a certificate already, skip to the next step, if not create a testing certificate with signtool.


Before creating the certificate, make sure you have password-enabled the Communicator Certificate DB. Select the Passwords option after selecting the Security icon in the Communicator toolbar and enter a password. For running signtool, text in bold is what you enter, everything else shown is just prompts.
signtool -G"testit" 
  -d "C:\Program Files\Netscape\Users\default"

using certificate directory: 
  C:\Program Files\Netscape\Users\default

Enter certificate information.  All fields are optional. 
Acceptable characters are numbers, letters, spaces, 
and apostrophes.
certificate common name: Counting Test Certificate
organization: MageLang
organization unit: Yes
state or province: CA
country (must be exactly 2 characters): US
username: jean
email address: jean.doe@jean.foo
Enter Password or Pin for "Communicator Certificate DB": 
  password 
  (password does not show when typed)
generated public/private key pair
certificate request generated
certificate has been signed
certificate "testit" added to database
Exported certificate to x509.raw and x509.cacert.

Task 5

Make a signing subdirectory. The signtool places everything from a particular directory tree into the Jar file.


For Windows:
mkdir signing

Task 6

Copy the .class files into the subdirectory.


For Windows:
copy *.class signing

Task 7

Create the signed Jar file with signtool and the testing certificate.


Be sure to use the appropriate directory name for the -d option. You will need to enter the password for the Communicator Certifcate DB before the signed file is created.
signtool -d "C:\Program Files\Netscape\Users\default" 
  -k testit -Z count.jar signing

Task 8

Verify the signing with signtool.


signtool -d "C:\Program Files\Netscape\Users\default" 
  -v count.jar

If everything signed okay, you should see something like the following:

using certificate directory: 
  C:\Program Files\Netscape\Users\default
archive "count.jar" has passed crypto verification.

          status   path
    ------------   -------------------
        verified   WordCount$1.class
        verified   WordCount$2.class
        verified   WordCount.class

Task 9

Create an HTML loader for the applet, referencing the signed cab file.


The option to remember is archive.
<applet code=WordCount width=300 height=100
  archive=count.jar>
</applet>

Task 10

FTP Jar file and HTML loader to a web server and try it out.


You'll have to locate a web server you have access to for this step. Just remember to transfer the Jar file in binary mode.

Task 11

Load program into Communicator and try it out.


This time when you are prompted for trusting the applet the certificate will have been signed.

Counting words takes time. You can comment out the print statement in the source to print each word as it is counted.

Copyright © 1998 MageLang Institute. All Rights Reserved.

[ This page was updated: 16-Nov-99 ]

Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-99 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy.