Channels ▼


Digitally Signing and Verifying Messages in Web Services

Signature Generation Using Oracle WSM

Oracle Web Services Manager can centrally manage the security policy, including digital signature generation. One of the greatest advantages in using Oracle WSM to digitally sign messages is that the policy information and the digital certificate information are centrally stored and managed.

An organization can have many web services and some of them might exchange certain business critical information and require that the messages be digitally signed. Oracle WSM will play a key role when different web services have different requirements to sign the message or when it is required to take certain actions before or after signing the message. Oracle WSM can be used to configure the signature at each web service level and that reduces the burden of deploying certifi cates across multiple systems. In this section, we will discuss more about how to digitally sign the response message of the web service using Oracle WSM.

Sign Message Policy Step

As a quick refresher, in Oracle WSM, each web service is registered within a gateway or an agent and a policy is attached to each web service. The policy steps are divided mainly into request pipeline template and response pipeline template, where different policies can be applied for request or response message processing. In this section, I describe how to confi gure the policy for a response pipeline template to digitally sign the response message. Note: It is assumed that the web service is registered within a gateway and a detailed example will be described later in this article.

In the response pipeline, we can add a policy step called Sign Message to digitally sign the message. To digitally sign a message, the key components that are required are:

  • Private key store
  • Private key password
  • The part of SOAP message that is being signed
  • The signature algorithm being used

The following screenshot describes the "Sign Message" policy step with certain values populated.

[Click image to view at full size]
Figure 1

The values that are populated are:

  • Keystore location -- The location where the private key fi le is located.
  • Keystore type -- Whether or not it is PKCS12 or JKS.
  • Keystore password -- The password to the keystore.
  • Signer's private-key alias -- The alias to gain access to the private key from the keystore.
  • Signer's private-key password -- the password to access the private key.
  • Signed Content -- Whether the BODY or envelope of the SOAP message should be signed.

The above information is a part of a policy that is attached to the time service which will sign the response message. As per the information that is shown in the screenshot, the BODY of the SOAP message response will be digitally signed using the SHA1 as the digest algorithm, and PKCS12 key store. Once the message is signed, the SOAP message will look like:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope soap:encodingStyle="
soap/encoding/" xmlns:xsi=""
xmlns:xsd="" xmlns:
  soap="" xmlns:
    <wsse:Security xmlns:wsse="http://docs.oasis-open.      org/wss/2004/01/oasis-200401-wss-wssecurity-secext-
      1.0.xsd" xmlns=""
   <wsse:BinarySecurityToken ValueType="http://docs."
       1.0#Base64Binary" wsu:Id="_VLL9yEsi09I9f5ihwae2lQ22" xmlns:wsu="http://docs.
    <dsig:Signature xmlns="
       xmldsig#" xmlns:dsig="">
         <dsig:Reference URI="#ishUwYWW2AAthrxhlpv1CA22">
         <dsig:Reference URI="#UljvWiL8yjedImz6zy0pHQ22">
           secext-1.0.xsd" wsu:Id="_7vjdWs1ABULkiLeE7Y4lAg22"
        <wsse:Reference URI="#_VLL9yEsi09I9f5ihwae2lQ22"/>
        <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.
             utility-1.0.xsd" wsu:Id="UljvWiL8yjedImz6zy0pHQ22">
        <soap:Body wsu:Id="ishUwYWW2AAthrxhlpv1CA22" xmlns:wsu="http://
        <n:getTimeResponse xmlns:n="urn:Test:GetTime">
      <Result xsi:type="xsd:string">10:13 AM</Result>

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.