JAXM Security

This document explains how to set up authentication in the JAXM reference implementation, and how to set up HTTPS for secure message exchange.

Authentication

For basic authentication, the JAXM reference implementation uses the userInfo part of the URL specification.

Secure transport

Setting up HTTPS is a bit more difficult. The critical part is setting up the server certificates, required by JSSE in order to communicate with the server. You'll need to use the following commands.
keytool  -genkey -alias jaxm-test -dname "cn=localhost" -keyalg RSA -storepass changeit
keytool -export -alias jaxm-test -storepass changeit -file server.cer  
keytool -import -v -trustcacerts -alias jaxm-test -file server.cer
   -keystore $JAVA_HOME/jre/lib/security/cacerts 
   -keypass changeit -storepass changeit

The first command will generate a server certificate in your $HOME/.keystore. The dname should be localhost (if you use localhost in the URLs) or your hostname (where you run the server).

The second command will export the certificate in a file, and the third will import the certificate into the list of certificates the client knows about.

An alternative is to use the server.cer and get it signed by one of the certificate authorities; it will then work with any client, without having to import the certificate into each client VM. Make sure you have added JSSE jars into the CLASSPATH, of course.

The next step is getting Tomcat to work with JSSE. This is documented in the Tomcat documentation (both 3.x and 4.0).

Start Tomcat and try a simple URL using HTTPS (like https://host:8443/index.html ). Netscape should ask you to accept a certificate and then display the page. If you got this to work, the server is running fine.

From the JAXM side, all you need to do is use URLs with https as the protocol. This will work only if the certificate was successfully imported into JAVA_HOME/jre/lib/security/cacerts; otherwise JSSE will not allow the connection.