HomeDigital EditionSys-Con RadioSearch Web Services Cd
B2B Beginning WS Business Process Management Case Studies Content Management Distributing Computing e-Business Electronic Data Interchange Enterprise Industry Insight Integration Interviews Java & Web Services .NET Portal Product Reviews Scalability & Performance Security SOAP Source Code UDDI Wireless WS Standards WS Tips & Techniques WSDL WS Editorials XML

Building Blocks II, by Murali Janakiraman
WSJ Vol 02 Issue 08 - pg.60

	


Listing 1: Encrypting part of an XML document

<?xml version='1.0'?> 
<PaymentInfo xmlns='http://example.org/paymentv2'> 
  <Name>John Smith</Name> 
 <CreditCard Limit='5,000' Currency='USD'> 
   <Number>4019 2445 0277 5567</Number> 
    <Issuer>Example Bank</Issuer> 
   <Expiration>04/02</Expiration> 
  </CreditCard> 
</PaymentInfo> 


Listing 2: Encryption of the entire CreditCard element

 <?xml version='1.0'?> 
<PaymentInfo xmlns='http://example.org/paymentv2'> 
 <Name>John Smith</Name> 
  <EncryptedData Type='http://www.w3.org/2001/04/xmlenc#Element' 
               xmlns='http://www.w3.org/2001/04/xmlenc#'> 
    <CipherData> 
      <CipherValue>A23B45C56</CipherValue> 
    </CipherData> 
  </EncryptedData> 
</PaymentInfo> 


Listing 3: XML digital signature structure

<Signature ID?> 
  <SignedInfo> 
    <CanonicalizationMethod/> 
    <SignatureMethod/> 
     (<Reference URI? > 
       (<Transforms>)? 
       <DigestMethod> 
         <DigestValue> 
    </Reference>)+ 
  </SignedInfo> 
  <SignatureValue/> 
  (<KeyInfo>)? 
  (<Object ID?>)* 
</Signature> 

Note: ? denotes zero or one occurrence, + denotes one 
or more occurrence, and * denotes zero or more occurrences.