WS-Security Integrity (XML Digital Signature)
•Robert Broeckelmann

This post continues exploring the use of XML Digital Signature; this time we look at WS-Security Integrity (use of XML Digital Signatures with WS-Security). Our examples show a digital signature and a timestamp in a WS-Security
For this example, we will use the SOAP Web Service that was introduced in this DataPower tutorial. The typical SOAP Response for this Web Service will look something like:
<soapenv:Envelope xmlns:ws=“http://ws.rcbj.com/“ xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/“>
soapenv:Body
ws:sumResponse
9
</ws:sumResponse>
</soapenv:Body>
</soapenv:Envelope>
If we add a digital signature and timestamp using WS-Security to this response, the message will look something like this. I tried to fit the full message on this screen, but the formatting wasn’t working. So, I’ll add snippets as appropriate in the following discussion.
The first thing to notice between the original SOAP Message and Message with the timestamp and digital signature added is the size increase. The original message is 317 bytes in length; the message with digital signature and timestamp is 4358 bytes in length. That is almost 14X larger. Of course, in the real world, soap responses for services doing real work will probably be longer than 317 bytes. Nevertheless, criticism surrounding WS-Security having bloated messages and overhead is not unfounded. Of course, any effective security solution that satisfies the same requirements will have similar characteristics.
WS-Security places all security meta-data in a SOAP Header called
<wsu:Timestamp wsu:Id=“.” xmlns:wsu=“.“>
wsu:Created2012-12-31T23:50:43Z</wsu:Created>
wsu:Expires2012-12-31T23:55:43Z</wsu:Expires>
</wsu:Timestamp>
The first child element of the
<wsse:BinarySecurityToken wsu:Id=“.” EncodingType=“.” xmlns:wsu=”“>
MIIDOjCCAqOgAwIBAgIEdOq6L.
</wsse:BinarySecurityToken>
The next child element of the
The last child element of the
- There are now two
elements in element. Notice that one points at the message body of the SOAP Message and the other points at the timestamp that was described previously. - The other difference is the
element contains a that points at the element described above.
The rest of the
The various specifications that are used in this example are listed here.

