Does this really work?

After all the work we've gone through to setup security, you might be a bit disappointed. After all, we've gone through all the trouble of setting up a CA and some certificates to end up writing a MathService client that behaves just like all the other MathService clients we've already seen in the tutorial. Ho hum. You're probably asking yourself: "Yeah, but is this really doing all that encryption thingy?"

To empirically prove that it is doing the 'encryption thingy', we are going to use a handy-dandy command-line tool included with Axis called TCPMonitor. This tool allows us to intercept the data that is sent from the client to the server (and vice versa). We will see how the information is, in fact, encrypted.

To start TCPMonitor, run this:

java org.apache.axis.utils.tcpmon 8081 localhost 8080

This starts an instance of the TCPMonitor. What the monitor will do is listen on port 8081 and redirect all the traffic it receives on that port to port 8080 (which is where our container is listening). This means that TCPMonitor acts like a proxy, not like a sniffer, so we'll have to tell our client to make the invocation on port 8081 to be able to see what kind of data is being sent.

The TCPMonitor interface should look something like this:

Let's run the client again. Make sure to change '8080' for '8081' so that the invocation will go through the TCPMonitor. Otherwise, we won't be able to see it.

java \
-classpath ./build/classes/:$CLASSPATH \
org/globus/progtutorial/clients/MathService/ClientGSIConvEncrypt \ \

Once you've invoked the service, you should see the following in the TCPMonitor:

The top list shows all the connections 'intercepted' by the TCPMonitor. You can select any of them to see what was sent to the server (first text area) and what the server replied to the client (second text area). There should be three pairs of connections (on pair for each of the invocations the client makes: add, subtract, and getValue.

Let's take a look at one of them:

<soapenv:Envelope xmlns:soapenv=""
  <wsse:Security xmlns:wsse=""
    soapenv:actor="" soapenv:mustUnderstand="0">
    <xenc:ReferenceList xmlns:xenc="">
    <xenc:DataReference URI="EncryptedBody"></xenc:DataReference>
  <xenc:EncryptedData xmlns:xenc=""
  Id="EncryptedBody" Type="">
    <xenc:EncryptionMethod Algorithm="">
    <ds:KeyInfo xmlns:ds="">

Holy gibberish, Batman! :-)

Notice how only certain parts of the message are encrypted, not the whole message. This is because GSI uses message-level security. This means that the message's format (SOAP) is not encrypted, but the contents of the message are (highlighted in bold). If we wanted the whole thing encrypted (both the message format and the message's content) we would need to use transport-level security. This type of security was supported by GSI in the past, but is now deprecated.