95-702 Distributed Systems - PowerPoint PPT Presentation

About This Presentation
Title:

95-702 Distributed Systems

Description:

95-702 Distributed Systems Lecture 14 Securing Web Services – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 68
Provided by: Michael2683
Category:

less

Transcript and Presenter's Notes

Title: 95-702 Distributed Systems


1
95-702 Distributed Systems Lecture 14 Securing
Web Services
2
XML Web Services
  • Hot topic
  • Foundation of Service Oriented Architectures
  • Interoperable
  • Remote Method Invocation
  • Messaging
  • Supported by all the big players
  • Notes adpated from the required reading Web
    Services Security,
  • Bilal Siddiqui

3
Existing XML Web Services
  • Google
  • EBay
  • Amazon
  • XIgnite (financial computations)
  • Many others in the cloud!
  • See www.xmethods.com
  • But remember, many are not public.
  • An SOA would have many in house web
  • services.

4
XML Web Services Cryptography
  • Bob and Alice want to exchange SOAP messages.
  • Eve and Mallory need to be taken
  • seriously.

5
Whats going on?
  • Web Services Security (WSS) specification from
    OASIS.
  • Adds message confidentiality to SOAP.
  • Adds message Identification, authentication,
    authorization, and non-repudiation to SOAP.
  • Why not simply use SSL?
  • SSL is cool but point to point.
  • An end-to-end approach carries the encrypted data
    and signatures and permits persistence.
  • SSL may be used along with WSS.

6
The WS Cryptography Stack
XML Web Services Security SAML (Security
Assertion ML),XKMS (XML Key Management
Specification), XACML (eXtensible Access Control
Markup Language)
XMLDSIG (W3C) XMLENC (W3C)
.NET Crypto APIs
Java Security APIs
7
Interoperable Web Services
  • We need application integration within the
    enterprise.
  • We need application integration across enterprise
    boundaries
  • customers
  • partners
  • suppliers
  • A Service Oriented Architecture may be built on a
    web service foundation, using services within the
    enterprise and in the cloud.

8
A Tourism Supply Chain
Hotel
Hotel
Tourists
Tour Operator
Car Rental
Car Rental
Hotel
Anyone may call
RoomRentInfoForAll()
Restricted callers
RoomRentInfoForPartnersOnly()
9
Service Oriented Architecture
SOAP over HTTP
SOAP Server
Hotel
RoomRentInfoForAll()
RoomRentInfoForPartnersOnly()
10
Listing 1 SOAP Request
POST /Vendors HTTP/1.1Host www.myHotel.comConte
nt-Type text/xmlCharsetutf-8Content-Length
350SOAPACtion"" lt?xml version'1.0'?gt  
ltSOAP-ENVEnvelope       xmlnsSOAP-ENV'http//s
chemas.xmlsoap.org/soap/envelope/' gt     
ltSOAP-EnvBodygt         ltsGetSpecialDiscountedBo
okingForPartners             xmlnss'http//www.
MyHotel.com/partnerservice/' gt        
lt!--Parameters passed with the method
call--gt         lt/sGetSpecialDiscountedBookingFo
rPartnersgt      lt/SOAP-EnvBodygt
lt/SOAP-EnvEnvelopegt
11
Listing 2 SOAP Response
HTTP/1.0 200 OKContent-Type text/xml
charsetutf-8Content-Length 1474lt?xml
version"1.0"gtltSOAP-ENVEnvelope   
xmlnsSOAP-ENV'http//schemas.xmlsoap.org/soap/en
velope/' gt   ltSOAP-ENVBodygt     
ltmGetSpecialDiscountedBookingForPartnersResponse
         xmlnsm"http//www.MyHotel.com/partnerse
rvice/" gt           lt!-- Booking
confirmation details--gt      lt/mGetSpecialDiscou
ntedBookingForPartnersResponsegt  
lt/SOAP-ENVBodygtlt/SOAP-ENVEnvelopegt
12
1st Generation Web Services

SOAP Server
Hotel Class
RDBMS
SOAP Client
13
2ND Generation Web Services

SOAP Server
Hotel Class
RDBMS
SOAP Server
Tour Planning Class
SOAP Client
14
3RD Generation Web Services


SOAP Server
Plane Class
RDBMS
SOAP Server
Hotel Class
RDBMS
WS-Transaction
SOAP Server
Tour Planning Class
SOAP Client
SOAP Server
Tour Planning Class
15
WS Security

SOAP Server
Hotel Class
RDBMS
SOAP Client
  • SOAP Server (SOAP Aware Firewall)
  • inspect SOAP message
  • match user roles with access lists
  • XML Signature
  • XML Encryption
  • WSS (SOAP specific use of XMLEnc and XMLDsig)
  • Security Access Markup Language (SAML) for
  • single sign on replacing HTTP cookies
  • XACML (extensible Access Control Markup
    Language)
  • to express authorization and access policies

16
XML SignatureAn IETF/W3C Recommendation

17
XML Digital Signatures
  • Quick Review
  • Message Digest
  • message digest algorithm -gt hash value
  • transmit (message,hash value) pair
  • useful for checking if errors occurred
  • Problem
  • Mallory might replace the message, hash value
    pair with her own message, hash value pair.

18
XML Digital Signatures
  • Solution (1) get a symmetric key
  • involved in the calculation of the hash.
  • Solution (2) Given a message m,
  • compute a hash of m and encrypt the
  • hash with an asymmetric private key.
  • Mallory doesnt know the keys. So, she
  • cant forge the signature.
  • But how do we do this in XML?

19
XML Signature
  • XML Signatures are digital signatures used in XML
    transactions
  • May be used to sign only a portion of an XML
    document. The document might have
  • a long history with different parts holding
    different signatures
  • The signature may apply to XML or non-XML data

20
Referencing What is Signed
  • The XML Signature may hold a URI.
  • This allows to point to a signed entity that may
    reside elsewhere.
  • Or, the signed content may be available in the
    XML document holding the signature.

21
XMLDsig General Form
The Components of an XML Signature
                                                  
                                                  
            
22
The ltReferencegt Element
  • Each signed resource is specified with
  • a ltReferencegt element
  • A typical ltReferencegt element will contain
  • - a pointer to what is signed
  • - a digest method (for example SHA1)
  • - and a digest value of the signed data in
  • base 64 notation

23
The ltReferencegt Element
This is the location of the document being signed.
  • ltReference URI http//.../po.xmlgt
  • ltDigestMethodgt.lt/DigestMethodgt
  • ltDigestValuegt calculated digest of
  • po.xml
  • lt/DigestValuegt
  • lt/Referencegt

24
We may have many references
  • ltReferencegt
  • pointer, digest method,
    digest value
  • lt/Referencegt
  • ltReferencegt
  • pointer, digest method,
    digest value
  • lt/Referencegt

25
Place Within a SignedInfo Element
  • ltSignedInfogt
  • ltCanonicalizationMethodgt algorithm used
    on

  • SignedInfo

  • element
  • ltSignatureMethodgt for example dsa-sha1
  • ltReferencegt
  • pointer, digest
    method, digest value
  • lt/Referencegt
  • ltReferencegt
  • pointer, digest
    method, digest value
  • lt/Referencegt
  • lt/SignedInfogt

26
Compute Digest of SignedInfo
  • ltSignedInfogt
  • ltCanonicalizationMethodgt algorithm used
    on

  • SignedInfo element
  • ltSignatureMethodgt for example dsa-sha1
  • ltReferencegt
  • pointer, digest
    method, digest value
  • lt/Referencegt
  • ltReferencegt
  • pointer, digest
    method, digest value
  • lt/Referencegt
  • lt/SignedInfogt

27
Sign the digest and place value in a
SignatureValue element
  • ltSignedInfogt
  • ltCanonicalizationMethodgt algorithm used
    on SignedInfo element
  • ltSignatureMethodgt for example dsa-sha1
  • ltReferencegt
  • pointer, digest
    method, digest value
  • lt/Referencegt
  • ltReferencegt
  • pointer, digest
    method, digest value
  • lt/Referencegt
  • lt/SignedInfogt
  • ltSignatureValuegtBase 64 signature of the
    SignedInfo Element
  • lt/SignatureValuegt

28
Enclose in a Signature Element
ltSignaturegt
  • ltSignedInfogt
  • ltCanonicalizationMethodgt algorithm used
    on SignedInfo

  • element
  • ltSignatureMethodgt for example dsa-sha1
  • ltReferencegt
  • pointer, method,
    digest value
  • lt/Referencegt
  • ltReferencegt
  • pointer, method,
    digest value
  • lt/Referencegt
  • lt/SignedInfogt
  • ltSignatureValuegtBase 64 signature of the
    SignedInfo Element
  • lt/SignatureValuegt

lt/Signaturegt
29
We may include KeyInfo
ltSignaturegt
  • ltSignedInfogt
  • ltCanonicalizationgt
  • ltSignatureMethodgt
  • ltReferencegt
  • ltReferencegt
  • lt/SignedInfogt
  • ltSignatureValuegtBase 64 signature of the
    SignedInfo Element
  • lt/SignatureValuegt
  • ltKeyInfogt
  • ltX509Datagt
  • ltX509SubjectNamegtCNCristina
    McCarthy, OCMU,
  • ltX509Certificategt base 64 public
    key and identity signed by a CA
  • lt/X509Certificategt
  • lt/X509Datagt
  • lt/KeyInfogt

lt/Signaturegt
30
KeyInfo Element in XMLDsig
  • Optional element
  • Holds key information required to validate the
    signature or
  • Points to that key information
  • May have children such as
  • ltPGPDatagt ltSPKIDatagt ltX509Datagt

31
What Can Mallory Do?
  • Can she modify the CA signed certificate so that
    someone else appears to have signed the document?
  • Can she modify what is being pointed by the
    reference element?
  • Can she change the canonicalization method?
  • Can she change the contents of the signature
    method tag?

32
Verification
  • 1. Canonicalize the SignedInfo element.
  • 2. Compute the digest of the SignedInfo
  • element using the method described within it
  • 3. Compare the above value with that value
  • got from applying the signers public key
  • to the value in the SignatureValue element
  • 4. Compute digests of referenced items (after any
  • transformations) and compare those digests
  • found within each reference tag

33
Using IBMs XML Security Suite
34
Sign a grade book
  • Gradebook.xml
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltGradeBookgt
  • ltStudentgt
  • ltScoregt100lt/Scoregt
  • ltScoregt89lt/Scoregt
  • lt/Studentgt
  • lt/GradeBookgt

35
We need keys
  • D\..\95-804\IBMXMLSecuritySuite\SampleSign2gt
  • keytool -genkey -keyalg RSA -keystore
    test.keystore
  • -dname "CNMike McCarthy, OUHeinz School,
  • OCMU, LPgh, SPA, CUS" -alias mjm
  • -storepass sesame -keypass sesame

Creates test.keystore holding keys and a
self-signed certificate
36
Run XSS4Js SampleSign2
  • D\...\95-804\IBMXMLSecuritySuite\
  • SampleSign2gtjava SampleSign2 mjm
  • sesame sesame
  • -embxml gradebook.xml gt signature.xml
  • Key store test.keystore
  • Sign 851ms

37
Examine Signature.xml
  • ltSignature xmlns"http//www.w3.org/2000/09/xmldsi
    g"gt
  • ltSignedInfogt
  • ltCanonicalizationMethod Algorithm"http//www.
    w3.org/TR/2001/REC-xml-c14n-20010315"gtlt/Canonicali
    zationMethodgt
  • ltSignatureMethod Algorithm"http//www.w3.org/
    2000/09/xmldsigrsa-sha1"gtlt/SignatureMethodgt

38
We are signing resource 0
Transforms Prior to hashing
  • ltReference URI"Res0"gt
  • ltTransformsgt
  • ltTransform Algorithm"http//www.w3.
    org/TR/2001/REC-xml-

  • c14n-20010315"gt
  • lt/Transformgt
  • lt/Transformsgt
  • ltDigestMethod
  • Algorithm"http//www.w3.org
    /2000/09/xmldsigsha1"gt
  • lt/DigestMethodgt
  • ltDigestValuegtm6f9xhOc4iEXokD/29V9EsdY3yI
  • lt/DigestValuegt
  • lt/Referencegt

39
  • lt/SignedInfogt
  • ltSignatureValuegt
  • Gll1H/uplOwfaX3j7ST6UqQlc92Hx2nsCdN2KWz32CW0
    D4hH64n32v/InkGux1dYgTya6S4s55iHqZEjDpH2I359H4PAxB
    YYXJj4LUBNxAFxUcDy6xrEUbLnKeutT5pf1DBSmxg9Cp3PO5Rs
    36nVN8GVfnFl1M86WQd19/RsAnA
  • lt/SignatureValuegt

40
  • ltKeyInfogt
  • ltKeyValuegt
  • ltRSAKeyValuegt
  • ltModulusgt
  • 7V5eyhVaw0clED11H6PTPoKQA1VxrLAugU3QxKA0
    hbbUOiavFbqCdc6ZFe9JZFMkS
  • IqdlkhwWwdAIsRyrN4V2DWm1fxyYQf6bdZgCa
    VVgkST1BpQxBTgNKRcS5VbLrXf
  • 4MXb5TbhAeo1Qbr2IjlV10aLbVhUk/gylagk
  • lt/Modulusgt
  • ltExponentgtAQABlt/Exponentgt
  • lt/RSAKeyValuegt
  • lt/KeyValuegt

41
  • ltX509Datagt
  • ltX509IssuerSerialgt
  • ltX509IssuerNamegtCNMike
    McCarthy,OUHeinz
  • School,OCMU,LPgh,STPA,CUS
  • lt/X509IssuerNamegt
  • ltX509SerialNumbergt1049138061
  • lt/X509SerialNumbergt
  • lt/X509IssuerSerialgt
  • ltX509SubjectNamegtCNMike
    McCarthy,OUHeinz
  • School,OCMU,LPgh,STPA,CUS
  • lt/X509SubjectNamegt
  • ltX509Certificategt

42
  • MIICPDCCAaUCBD6Ik40wDQYJKoZIhvcNAQEEBQAwZTELMAkGA
  • UEBhMCVVMxCzAJBgNVBAgTAlBBMQwwCgYDVQQHEwNQZ2gx
  • DAKBgNVBAoTA0NNVTEVMBMGA1UECxMMSGVpbnogU2Nob29s
  • RYwFAYDVQQDEw1NaWtlIE1jQ2FydGh5MB4XDTAzMDMzMTE5M
  • QyMVoXDTAzMDYyOTE5MTQyMVowZTELMAkGA1UEBhMCVVMx
  • zAJBgNVBAgTAlBBMQwwCgYDVQQHEwNQZ2gxDDAKBgNVBAoT
  • 0NNVTEVMBMGA1UECxMMSGVpbnogU2Nob29sMRYwFAYDVQQ
  • Ew1NaWtlIE1jQ2FydGh5MIGfMA0GCSqGSIb3DQEBAQUA
  • A4GNADCBiQKBgQDtXl7KFVrDRyUQPXUfo9MgpADVXGssC6BT
  • DEoDSFttQ6Jq8VuoJ1zpn4V70lkUyRIip2X6SHBbB34AixHKs3
    hXYN
  • bV/7HJhB/pt1mAJpVWCRJPUGlDEFOA0pFxLlVsutd/gxdvl
  • NuED56jVBuvYiOVXXRottWFSTD7KVqD6QIDAQABMA0GCSqG
  • 3DQEBBAUAA4GBAMpUaA8Cw8mKQn408KuV4xrTciEEcTLNniDGn
  • 8d9W1fR4veqhKz8L88864bNS5Wih1oEC5k/da23QicpTdXf
    UyA1c
  • 9Zu3cGU4ulUfhFPWv0IgdpI63KQt9QwsuTxWck5dAta2KWWTv
    85I
  • ByHXgoaDlvJ65JjT87nAPAI3

43
The resource 0 object
  • lt/X509Certificategt
  • lt/X509Datagt
  • lt/KeyInfogt
  • ltdsigObject xmlns""

  • xmlnsdsig"http//www.w3.org/2000/09/xmldsig"
  • Id"Res0"gt
  • ltGradeBookgt
  • ltStudentgt
  • ltScoregt100lt/Scoregt
  • ltScoregt89lt/Scoregt
  • lt/Studentgt
  • lt/GradeBookgt
  • lt/dsigObjectgt
  • lt/Signaturegt

44
Lets change the low grade!
  • ltdsigObject xmlns"" xmlnsdsig"http//www.w3.o
    rg/2000/09/xmldsig" Id"Res0"gt
  • ltGradeBookgt
  • ltStudentgt
  • ltScoregt100lt/Scoregt
  • ltScoregt100lt/Scoregt
  • lt/Studentgt
  • lt/GradeBookgtlt/dsigObjectgt

45
And run verify
  • D\McCarthy\www\95-804\IBMXMLSecuritySuite\SampleS
    ign2gtjava VerifyCUI lt signature.xml
  • The signature has a KeyValue element.
  • The signature has one or more X509Data elements.
  • Checks an X509Data
  • 1 certificate(s).
  • Certificate Information
  • Version 1
  • Validity OK
  • SubjectDN CNMike McCarthy, OUHeinz
    School, OCMU, LPgh, STPA, CUS
  • IssuerDN CNMike McCarthy, OUHeinz
    School, OCMU, LPgh, STPA, CUS
  • Serial 0x3e88938d
  • Time to verify 521 msec
  • Core Validity NG
  • Signature Validity OK
  • 0 "Res0" NG Digest value mismatch
    calculated tfVyHns8wRB6l/HDU2dXZkzf7Q
  • Exception in thread "main" java.lang.RuntimeExcept
    ion Core Validity NG
  • at dsig.VerifyCUI.main(VerifyCUI.java137)

46
Another Example PO.XML
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltPurchaseOrder xmlns"urnpurchase-order"gt
  • ltCustomergt
  • ltNamegtRobert Smithlt/Namegt
  • ltCustomerIdgt788335lt/CustomerIdgt
  • lt/Customergt
  • ltItem partNum"C763"gt
  • ltProductIdgt6883-JF3lt/ProductIdgt
  • ltQuantitygt3lt/Quantitygt
  • ltShipDategt2002-09-03lt/ShipDategt
  • ltNamegtThinkPad X20lt/Namegt
  • lt/Itemgt
  • lt/PurchaseOrdergt

47
PO After Signing
  • lt?xml version'1.0' encoding'UTF-8'?gt
  • ltSignedPurchaseOrdergt
  • ltPurchaseOrder id"id0" xmlns"urnpurchase-o
    rder"gt
  • ltCustomergt
  • ltNamegtRobert Smithlt/Namegt
  • ltCustomerIdgt788335lt/CustomerIdgt
  • lt/Customergt
  • ltItem partNum"C763"gt
  • ltProductIdgt6883-JF3lt/ProductIdgt
  • ltQuantitygt3lt/Quantitygt
  • ltShipDategt2002-09-03lt/ShipDategt
  • ltNamegtThinkPad X20lt/Namegt
  • lt/Itemgt
  • lt/PurchaseOrdergt

48
  • ltSignature xmlns"http//www.w3.org/2000/09/xmldsi
    g"gt
  • ltSignedInfogt
  • ltCanonicalizationMethod Algorithm"http//www
    .w3.org/TR/2001/REC-xml-c14n-20010315"/gt
  • ltSignatureMethod Algorithm"http//www.w3.org/
    2000/09/xmldsigrsa-sha1"/gt
  • ltReference URI"id0"gt
  • ltDigestMethod Algorithm"http//www.w3.org/2
    000/09/xmldsigsha1"/gt
  • ltDigestValuegtUfeiscUCL7QkhZtRDLWDPWLpVlAlt/D
    igestValuegt
  • lt/Referencegt
  • lt/SignedInfogt

49
  • ltSignatureValuegt
  • Ptysg8WdHI2mxwryOOt5I9r9qZm/2gNFNOJyH1Wak4nCUe
    gRpe72tWnsigAKZyopmgUSH3TG
  • aGGQF1BTSvk3JUUY/ljrw5FpTpf3hgZBi7GSWf6WtXqZvM
    YGUKIlvR/421MZg7P9XRUyy37
  • ZUzQHtmCYkBorEkEx1J4CYB0G2c
  • lt/SignatureValuegt

50
  • ltKeyInfogt
  • ltX509Datagt
  • ltX509Certificategt
  • MIIDGjCCAoOgAwIBAgICAQAwDQYJKoZIhvcNAQEFBQ
    AwXzELMAkGA1UEBhMCSlAxETAPBgNVBAgT
  • CEthbmFnYXdhMQ8wDQYDVQQHEwZZYW1hdG8xDDAKBg
    NVBAoTA0lCTTEMMAoGA1UECxMDVFJMMRAw
  • DgYDVQQDEwdUZXN0IENBMB4XDTAxMTAwMTA3MTYxMF
    oXDTExMTAwMTA3MTYxMFowUDELMAkGA1UE
  • BhMCSlAxETAPBgNVBAgTCEthbmFnYXdhMQwwCgYDVQ
    QKEwNJQk0xDDAKBgNVBAsTA1RSTDESMBAG
  • A1UEAxMJU2lnbmF0dXJlMIGfMA0GCSqGSIb3DQEBAQ
    UAA4GNADCBiQKBgQCvnFQiPEJnUZnkmzoc
  • MjsseD8ms9HBgasZR0VOAvsby5aajsm9CtB18dDCem
    DXZ2YjBdprXepfF4SLNP5ankfphhr9QXA
  • NJdCKpyF3jPoydckle7E7gI9w3Q4NDa4ryVOuIS2q
    ev6jlE7OVPqiXIDVlCH4u6GbIoJEpJ57yzx
  • dQIDAQABo4HzMIHwMAkGA1UdEwQCMAAwCwYDVR0PBA
    QDAgXgMCwGCWCGSAGGEIBDQQfFh1PcGVu
  • U1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ
    4EFgQUYapFv9MvQ9NNn1Q7zgzqka4XORsw
  • gYgGA1UdIwSBgDBgBR7FuT9bLBj3vVsgAzIeYa4hB
    UZBaFjpGEwXzELMAkGA1UEBhMCSlAxETAP
  • BgNVBAgTCEthbmFnYXdhMQ8wDQYDVQQHEwZZYW1hdG
    8xDDAKBgNVBAoTA0lCTTEMMAoGA1UECxMD
  • VFJMMRAwDgYDVQQDEwdUZXN0IENBggEAMA0GCSqGSI
    b3DQEBBQUAA4GBALFzGDXMzxJvOnCdJCMZ
  • 2NsZdz1wmoYyejB5J6Ch2ygdPeibMnW/CiYKCTWBh
    pEgxEqr1BNlgSVqA6nyvjHsVIvgBfwx37D
  • hJ5hz4azpWu1X22XqyU9fUqoQUtEAdM/MlLekBkprk
    JVb9uJXTFzzvm/3DoEiBkX/BT78YdM8eq0

51
WSS XMLDSig Listing 1
  • lt?xml version1.0?gtltSOAP-ENVEnvelope    x
    mlnsSOAP-ENVhttp//schemas.xmlsoap.org/soap/env
    elope/gt    ltSOAP-ENVBodygt        ltsGetSpecial
    DiscountedBookingForPartners            xmlnss
    http//www.MyHotel.com/partnerservice/gt         
            lt!--Parameters passed with the method
    call--gt         lt/sGetSpecialDiscountedBookingFo
    rPartnersgt    lt/SOAP-ENVBodygtlt/SOAP-ENVEnvelop
    egt

From Web Services Security, Bilal
Siddiqui There is no XMLDS in this example.
52
Sign The SOAP Request
  • lt?xml version1.0?gtltSOAP-ENVEnvelope    
    xmlnsSOAP-ENVhttp//schemas.xmlsoap.org/soap/en
    velope/    xmlnsdshttp//www.w3.org/2000/09/x
    mldsiggt    ltSOAP-ENVHeadergt        ltdsSigna
    turegt lt! wraps all other XMLDS
    elements?             ltdsSignedInfogt
    lt! note the ds prefix ?             lt/dsSignedI
    nfogt lt! note three children of Signature
    ?             ltdsSignatureValuegt             lt/
    dsSignatureValuegt             ltdsKeyInfogt     
            lt/dsKeyInfogt        lt/dsSignaturegt    
    lt/SOAP-ENVHeadergt    ltSOAP-ENVBodygt        lts
    GetSpecialDiscountedBookingForPartners          
      xmlnsshttp//www.MyHotel.com/partnerservice/
    gt                 lt!--Parameters passed with the
    method call--gt         lt/sGetSpecialDiscountedBo
    okingForPartnersgt    lt/SOAP-ENVBodygtlt/SOAP-ENV
    Envelopegt

53
After Signing (1)
lt?xml version1.0?gtltSOAP-ENVEnvelope    xmlns
SOAP-ENVhttp//schemas.xmlsoap.org/soap/envelop
e/    xmlnsdshttp//www.w3.org/2000/09/xmldsi
ggt    ltSOAP-ENVHeadergt        ltdsSignaturegt
             ltdsSignedInfogt                 
ltdsCanonicalizationMethod                     
Algorithm"http//www.w3.org/2001/10/xml-exc-c14n
"/gt                  ltdsSignatureMethod        
              Algorithm"http//www.w3.org/2000/09
/xmldsigrsa-sha1"/gt                 
ltdsReference URI"GetSpecialDiscountedBookingFor
Partners"gt                     
ltdsTransformsgt                         
ltdsTransform                             
Algorithm"http//www.w3.org/2001/10/xml-exc-c14n
"/gt                      lt/dsTransformsgt       
              
54
After Signing (2)
ltdsDigestMethod             
             Algorithm"http//www.w3.org/2000/09/
xmldsigsha1"/gt                     
ltdsDigestValuegt                         
BIUddkjKKo2...                     
lt/dsDigestValuegt                 
lt/dsReferencegt             lt/dsSignedInfogt    
         ltdsSignatureValuegt                 halH
Jghyf765....             lt/dsSignatureValuegt   
          ltdsKeyInfogt lt! the key name for
signature verification ?                 ltdsKeyN
amegtMyKeyIdentifierlt/dsKeyNamegt             lt/ds
KeyInfogt lt! application dependent, perhaps
a symmetric key ID?         lt/dsSignaturegt    lt
/SOAP-ENVHeadergt
55
After Signing (3)
    ltSOAP-ENVBodygt        ltsGetSpecialDiscounte
dBookingForPartners            xmlnsshttp//ww
w.MyHotel.com/partnerservice/            ID"Get
SpecialDiscountedBookingForPartners"gt            
     lt!--Parameters passed with the method
call--gt         lt/sGetSpecialDiscountedBookingFo
rPartnersgt    lt/SOAP-ENVBodygtlt/SOAP-ENVEnvelo
pegt
56
XML Encryption
  • W3C Recommendation 10 December 2002
  • Notes from
  • http//www-106.ibm.com/developerworks/library/x-e
    ncrypt/index.html
  • by Bilal Siddiqui
  • And Secure XML by Eastlake and Niles
    Addison Wesley

57
General Form 1
  • ltEncryptedDatagt
  • ltCipherDatagt
  • ltCipherValuegt
  • cipher text in Base 64
  • lt/CipherValuegt
  • lt/CipherDatagt
  • lt/EncryptedDatagt

58
General Form 2
  • ltEncryptedDatagt
  • ltCipherDatagt
  • ltCipherReferencegt
  • pointer (URL) to cipher text
  • lt/CipherReferencegt
  • lt/CipherDatagt
  • lt/EncryptedDatagt

59
EncryptedData is the core element
  • Replaces the encrypted element or
  • Serves as the new document root
  • May contain a KeyInfo element that describes the
    key needed for decryption (borrowed from XML
    Digital Signature) or
  • signature verification

60
General Example (1)
  • ltMedInfogt
  • ltIDgt
  • ltNamegt
  • ltAddressgt
  • lt/IDgt
  • ltMedicalgtlt/Medicalgt
  • ltFinancialgtlt/Financialgt
  • lt/MedInfogt

61
General Example (2)
  • ltMedInfogt
  • ltIDgt.lt/IDgt
  • ltEncryptedDatagt
  • ltKeyInfogt
  • ltKeyNamegtMedical
  • lt/KeyInfogt
  • ltCipherDatagt
  • ltCipherValuegt cipher text
  • lt/EncryptedDatagt

62
General Example (3)
  • ltFinancialgt
  • ltEncryptedDatagt
  • ltKeyInfogt
  • ltKeyNamegtPay
  • lt/KeyInfogt
  • ltCipherDatagt
  • ltCipherValuegt cipher text
  • lt/EncryptedDatagt
  • lt/Finacialgt
  • lt/MedInfogt

63
Detailed Example (Listing 1)
  • ltpurchaseOrdergt
  • ltOrdergt
  • ltItemgtbooklt/Itemgt
  • ltIdgt123-958-74598lt/Idgt
  • ltQuantitygt12lt/Quantitygt
  • lt/Ordergt
  • ltPaymentgt
  • ltCardIdgt123654-8988889-9996874lt/CardI
    dgt
  • ltCardNamegtvisalt/CardNamegt
  • ltValidDategt12-10-2004lt/ValidDategt
  • lt/Paymentgt
  • lt/purchaseOrdergt

64
Encrypting the Entire File (Listing 2)
  • lt?xml version'1.0' ?gt
  • ltEncryptedData xmlns'http//www.w3.org/2001/04/xm
    lenc' Type'http//www.isi.edu/in-notes/iana/assi
    gnments/media-types/text/xml'gt
  • ltCipherDatagt
  • ltCipherValuegtA23B45C56lt/CipherValuegt
  • lt/CipherDatagt
  • lt/EncryptedDatagt

IANA Internet Assigned Numbers Authority a
function of The Internet Corporationfor
Assigned Names and Numbers
65
Encrypting The Payment (Listing 3)
  • lt?xml version'1.0' ?gt
  • ltPurchaseOrdergt
  • ltOrdergt
  • ltItemgtbooklt/Itemgt
  • ltIdgt123-958-74598lt/Idgt
  • ltQuantitygt12lt/Quantitygt
  • lt/Ordergt
  • ltEncryptedData
  • Type'http//www.w3.org/2001/04/xm
    lencElement'
  • xmlns'http//www.w3.org/2001/04/
    xmlenc'gt
  • ltCipherDatagt
  • ltCipherValuegtA23B45C564587lt
    /CipherValuegt
  • lt/CipherDatagt
  • lt/EncryptedDatagt
  • lt/PurchaseOrdergt

One element
66
Encrypting Only the CardId (Listing 4)
  • lt?xml version'1.0' ?gt
  • ltPurchaseOrdergt
  • ltOrdergt
  • ltItemgtbooklt/Itemgt
  • ltIdgt123-958-74598lt/Idgt
  • ltQuantitygt12lt/Quantitygt
  • lt/Ordergt
  • ltPaymentgt
  • ltCardIdgt
  • ltEncryptedData
  • Type'http//www.w3.org/2001/04/x
    mlencContent'
  • xmlns'http//www.w3.o
    rg/2001/04/xmlenc'gt
  • ltCipherDatagt
  • ltCipherValuegtA23B45C564587lt
    /CipherValuegt
  • lt/CipherDatagt
  • lt/EncryptedDatagt
  • lt/CardIdgt
  • ltCardNamegtvisalt/CardNamegt
  • ltValidDategt12-10-2004lt/CardNamegt

Element content
67
Encrypting Non-XML Data (Listing 5)
  • lt?xml version'1.0' ?gt
  • ltEncryptedData xmlns'http//www.w3.org/2001/04/xm
    len'
  • Type'http//www.isi.edu/in-notes/iana/assig
    nments/media-types/jpeg' gt
  • ltCipherDatagt
  • ltCipherValuegtA23B45C56lt/CipherVal
    uegt
  • lt/CipherDatagt
  • lt/EncryptedDatagt
Write a Comment
User Comments (0)
About PowerShow.com