FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Database
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
July 22, 2008

Digitally Signing and Verifying Messages in Web Services

(Page 2 of 5)

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="http://schemas.xmlsoap.org/
soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:
  soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:
    soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <soap:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.      org/wss/2004/01/oasis-200401-wss-wssecurity-secext-
      1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
   soap:mustUnderstand="1">
   <wsse:BinarySecurityToken ValueType="http://docs.
     oasis-open.org/wss/2004/01/oasis-200401-wssx509-token-profile-1.0#X509v3"
     EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-messagesecurity-
       1.0#Base64Binary" wsu:Id="_VLL9yEsi09I9f5ihwae2lQ22" xmlns:wsu="http://docs.
        oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-
         utility-1.0.xsd">SecurityTOkenoKE2ZA==<
          /wsse:BinarySecurityToken>
    <dsig:Signature xmlns="http://www.w3.org/2000/09/
       xmldsig#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
    <dsig:SignedInfo>
    <dsig:CanonicalizationMethodAlgorithm="http://www.w3.org/2001/10/
       xml-exc-c14n#"/>
         <dsig:SignatureMethodAlgorithm="http://www.w3.org/2000/09/
           xmldsig#rsa-sha1"/>
         <dsig:Reference URI="#ishUwYWW2AAthrxhlpv1CA22">
         <dsig:Transforms>
         <dsig:TransformAlgorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
         </dsig:Transforms>
         <dsig:DigestMethodAlgorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
         <dsig:DigestValue>ynuqANuYM3qzhdTnGOLT7SMxWHY=</dsig:DigestValue>
         </dsig:Reference>
         <dsig:Reference URI="#UljvWiL8yjedImz6zy0pHQ22">
         <dsig:Transforms>
         <dsig:TransformAlgorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
         </dsig:Transforms>
         <dsig:DigestMethodAlgorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
         <dsig:DigestValue>9ZebvrbVYLiPZ
           v1BaVLDaLJVhwo=</dsig:DigestValue>
         </dsig:Reference>
         </dsig:SignedInfo>
         <dsig:SignatureValue>QqmUUZDLNeLpAEFXndiBLk=</dsig:SignatureValue>
         <dsig:KeyInfo>
         <wsse:SecurityTokenReference
           xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-
           secext-1.0.xsd" wsu:Id="_7vjdWs1ABULkiLeE7Y4lAg22"
            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-
             wss-wssecurity-utility-1.0.xsd">
        <wsse:Reference URI="#_VLL9yEsi09I9f5ihwae2lQ22"/>
        </wsse:SecurityTokenReference>
        </dsig:KeyInfo>
        </dsig:Signature>
        <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.
           org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
            xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-
             utility-1.0.xsd" wsu:Id="UljvWiL8yjedImz6zy0pHQ22">
        <wsu:Created>2007-11-16T15:13:48Z</wsu:Created>
        </wsu:Timestamp>
        </wsse:Security>
        </soap:Header>
        <soap:Body wsu:Id="ishUwYWW2AAthrxhlpv1CA22" xmlns:wsu="http://
           docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurityutility-1.0.xsd">
        <n:getTimeResponse xmlns:n="urn:Test:GetTime">
      <Result xsi:type="xsd:string">10:13 AM</Result>
    </n:getTimeResponse>
  </soap:Body>
</soap:Envelope>
Previous Page | 1 Introduction | 2 Signature Generation Using Oracle WSM | 3 Internals of Sign Message Policy Step | 4 Signature Verification by Oracle WSM | 5 Microsoft .NET Client Application Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK