Sample code for a JCSI S/MIME servlet 
=====================================

This directory houses a sample servlet which uses JCSI S/MIME.

This example requires JavaMail & the Java Activation Framework from
Sun to be installed. It also requires the Java servlet development kit 
(JSDK) 2.1.

The mail.jar, activation.jar, servlet.jar & server.jar from these
distributions, together with jcsi.jar from the current JCSI distribution
should all be in the extensions sub-directory on your system. Not having
mail.jar, activation.jar & jcsi.jar together in the extensions directory
causes a JAF exception to be thrown (JAF bug?).

The webserver supplied with JSDK 2.1 is used to run the servlet. It should
be easy to adapt the setup to the servlet-capable Web server of your
choice.

Contents
--------

  README          this document
  jcsi/           source code
  classes/        compiled .class files
  Makefile        a Unix Makefile in case re-compilation is necessary
  startserver     a Unix shell script to start the web server
  webpages/       a directory for web pages and servlets
  work/           a directory for temporary files generated by the server

Re-compilation
--------------

Compiled classes for the sample programs are included in the classes/
directory for convenience. If re-compilation is necessary (for instance,
if you change the source code), the included Makefile should suffice.

The servlet
-----------

The example servet accepts an e-mail address from a Web page and sends
a signed S/MIME message to that address. 

To run it, first make sure that the Setup instructions below have been 
followed. In addition, make sure you have valid entries in smime.properties 
for

  jcsi.smime.sender
  
and

  mail.smtp.host,

for, respectively, your e-mail address and mail host.

Next run the Unix shell script ./startServer (without any command line
arguments). This puts the webserver to listen on port 8000 on the localhost.
Aim a Web browser at the URL

  http://localhost:8000/

and follow the instructions there.

Check your e-mail with an S/MIME-capable mail client. You will find that
it complains about e-mail address mismatches. To correct this, generate 
your own keys & certificates (eg. with caTool) and use these instead of
the default ones.

Setup
-----

This distribution contains jar files, compiled classes & key files,
(almost!) sufficient to run both the sample servlet in this directory. 

Be sure to follow these instructions:

  0. Make sure you have JDK 1.2 properly set up, and the DSTC provider
     configured (See the top-level README if necessary)

  1. Make a copy of the <jcsi_install_dir>/.jcsi/ sub-directory under
     your home directory.

  2. In the file smime.properties in <your_home_directory>/.jcsi/, change
     the 'jcsi.smime.key.dir' entry to point to the full pathname of the
     <your_home_directory>/.jcsi/keys/ directory.

     (for Windows use "\\" as the path separator,
      eg. C:\\WINNT\\Profiles\\Administrator\\.jcsi\\keys)

