Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML Encryption and Authentication March 30, 2006 Robert Richards.

Similar presentations

Presentation on theme: "XML Encryption and Authentication March 30, 2006 Robert Richards."— Presentation transcript:

1 XML Encryption and Authentication March 30, 2006 Robert Richards

2 Digital Signatures and Encryption  Canonicalization –A standard form of data  Digital Signatures –Provides proof of identity and authenticity which the sender cannot deny.  Encryption –Protection of data from being accessed by unauthorized parties.

3 Existing Tools/Technologies  Secure Sockets Layer (SSL)  Transport Layer Security (TLS)  Pretty Good Privacy (PGP)  GNU Privacy Guard (GnuPG)  OpenPGP  S/MIME  x.509

4 XML Security Standards  Canonical XML  Exclusive XML Canonicalization  XML Signature  XML Encryption  XML Key Management

5 Transmitting Data Over SSL/TLS

6 Encrypted Document using GPG -----BEGIN PGP MESSAGE----- Version: GnuPG v1.2.4 (GNU/Linux) hQEOA0vM7Sf46MPAEAP/ajYbYuhRB7E8tbg1HpG0g3Ez1io/mn5amGlPJcsjR0T2 VrWGcJZjriUCqTEeRbAKMcvtI/RRLdhE0f9xGtFpmKTBFfYPQ/Jh+0+Nhzdjcfaz scY9vkWvIRopvYnxXnso6OXHoNBGDcYNcCing/I7Vl/Mr6fgG+4w+wqGbhYVKwAD /A/9Vwq6K6HcHpA2BdCbXfC2lwFgxEQmTolSK47PNM3kNb6X6UDTsB2rCJcVHG1O 7VmNhRlZfM00q79C9MelmTb+4dSbr9BXImFBvKXbIImCEOAzokj0rC9ntTnSFsJr Xc+xjS/SyJ9TjEOfs44LHCEjXCs10jsS7nW44dabOMy/0sByAasUfuRnUOAafoEw 7PraKOgPolCS8EkHik1Zt3+KsjPWBcDRHCWRBTtzJPqAcEMX0oL3DX2AiAnl5QUz M1pCv4eG5tE4u2tkPmywG2jrJSQH7sa2/5zwonaMSH5F+/N3rHk8+LAswqEJkl/j BJOU+BcH8A/sG9hOH3DOHixMTDkOVb3tYXASGUVqmR9AQU3/14Oc8wMGw6GXb MxuNs6gtZIdF2dRilu+EXvR41ytRR08HIwhi0VTRtF1gFoqLWK3J7De8Bbqejx9D YvQKr4xgKGkrSdTQyBldvoVdRJ/7ZFLVdQyrVJlFABeli87QkWfMtO8exr7raEvp J+ha+c1qWC87xpDZHfv0yatSKYt+8NxvwoXx9Kk1jx046sBQ+CjO26P/fe+plHOB mvEm/p1m =6HEC -----END PGP MESSAGE-----

7 Benefits of XML Security Standards  XML is a structured format  Allows for secure storage of documents  Leverages existing technologies  Provides granularity

8 XML Canonicalization A standard serialization of an XML document or XPath node set

9 Canonical XML (C14N)  The document is encoded in UTF-8  Line breaks normalized to #xA (linefeed) on input, before parsing  The XML declaration and DTD are removed  Empty elements are converted to start-end tag pairs  Whitespace outside of the document element and within start and end tags is normalized  Attribute value delimiters are set to double quotes  Superfluous namespace declarations are removed from each element  Lexicographic order is imposed on the namespace declarations and attributes of each element

10 Canonical XML Example #1 Canonical Form of Document (uncommented)

11 Canonical XML Example #1 Canonical Form of Document (uncommented)

12 Canonical XML Example #1 Canonical Form of Document (uncommented)

13 Canonical XML Example #1 Canonical Form of Document (uncommented)

14 Canonical XML Example #2 Canonical Form of Nodeset (uncommented) (//. | | //namespace::*)[ancestor-or-self::d:e2]

15 Canonical XML Example #2 Canonical Form of Nodeset (uncommented) (//. | | //namespace::*)[ancestor-or-self::d:e2]

16 Canonical XML Example #2 Canonical Form of Nodeset (uncommented) (//. | | //namespace::*)[ancestor-or-self::d:e2]

17 Problem with Re-Enveloping content content content content content

18 Exclusive XML Canonicalization  Follows the same rules as Canonical XML, except…  Attributes in the xml namespace are not imported into orphan nodes  Namespaces not specially told to be added are only added on the starting element for which they are visible and not currently in scope within the output.

19 Re-Enveloping using Exclusive content content content content content

20 Exclusive Canonical XML Example Exclusive Canonical Form of Nodeset (uncommented) (//. | | //namespace::*)[ancestor-or-self::d:e2]

21 XML Digital Signature (XMLDSIG)  Insure that a message has not been altered or tampered with. (integrity)  Protection against attacks that alter a message but maintain integrity. (message authentication)  Provide a means for message auditing so that messages may not be repudiated. (signer authenticity)

22 XML Signature: Types of Signatures  Enveloping Signature –Data lives within the XML Signature structure –Good for signing data being packaged within an XML payload  Enveloped Signature –Data lives outside of and contains the XML Signature structure –Good for signing an entire XML document  Detached Signature –Data lives outside and DOES NOT contain the XML Signature structure –Data may reside at a remote location addressable by URI

23 Enveloping Signature C2g9BLcGyGPCVKuF2byR1Ym+6pE= +R/XEOHDvR/jbmmpiuH4ZcRqC6c= Hello World!

24 Enveloped Signature content MMMkB0ZPp82XrUvJMFqDIEuXy0o= mVPvfcVSXi9elKL+IcSCAzD4Jbk=

25 Detached Signature oLZZOWcLwsAQ9NXWoLPk5FkPuSs= O9ykpFMXmkddzJ3CySrpzHBUW/Q=

26 XML Signature Example C2g9BLcGyGPCVKuF2byR1Ym+6pE= +R/XEOHDvR/jbmmpiuH4ZcRqC6c= Hello World! Hello World! Resulting Enveloping Signature:

27 XML Signature Generation 1. Apply any transforms to the data 2. Calculate the digest value 3. Create the Reference Element 4. Create SignedInfo element with SignatureMethod, CanonicalizationMethod and Reference elements 5. Canonicalize the SignedInfo element 6. Calculate the SignatureValue over the canonicalized SignedInfo based the SignatureMethod 7. Assemble the Signature element

28 XML Signature Validation 1. Obtain the verification keying information. 2. Apply the CanonicalizationMethod to the SignedInfo element. 3. Verify the SignatureValue using the canonical form of the SignatureMethod. 4. For each Reference element within SignedInfo: –Obtain the data to be digested. –Digest the data using the DigestMethod within its Referece element. –Compare the computed value to that of the un- encoded value from the DigestValue element.

29 XML Encryption (XMLENC)  Encrypted data is maintained.  All information needed to decrypt a document is contained within the document.  Session can be secured on the document level and shared between multiple parties.  Sensitive data is easily interchanged between applications.

30 XML Encryption Example 1001 Joe Smith

31 XML Encryption Example Element with Shared Secret Key 1001 Joe Smith C5X1I65RCX…

32 XML Encryption Example Element Content with Shared Secret Key 1001 Joe Smith C5X1I65RCX…

33 XML Encryption Example Arbitrary Data with Shared Secret Key ...C5X1I65RCX...

34 XML Encryption Example Unsupported 1001 Joe Smith mcryptiv w1Uy6MvHZNY= F541I65RCX…

35 XML Encryption: Encrypting 1. Select the algorithm (and parameters) to use in encrypting the item. 2. Obtain the key and create ds:KeyInfo if necessary 3. Encrypt the data and prepend any appropriate initialization vector (IV). 4. Build CipherData element –If to be stored within CipherValue element, then encrypted data is base64 encoded. –If encrypted data is external, then create CipherReference with URI and any transforms. 5. Build EncryptedData or EncryptedKey structure

36 XML Encryption: Decrypting 1. Determine encryption algorithm and parameters. 2. Obtain the decryption key information. 3. Obtain the data to decrypt. –If CipherData has a CipherValue child then base-64 decode its contents. –If CipherData has a CipherReference child, retrieve the data and apply any Transforms. 4. Depending upon algorithm and parameters, strip any IV from the data to use for decryption. 5. Decrypt the cipher data with the encryption algorithm, parameters, and keying material.

37 Signing and Encrypting  Sign and then Encrypt –Provides signature protection –Allows for encryption algorithm to be changed without affecting signature –Incurs additional overhead as you must decrypt before you can verify  Encrypt and then Sign –Immediately know if data has been tampered with –Document can no longer be shared with other parties without revealing decryption key –Sender identity is revealed

38 XML Signature in WS-Security … qZk+NkcGgWq6PiVxeFDCbJ==......

39 XML Encryption in WS-Security ...

40 Questions?

41 XML Signature using Digital Certificate Hello, World! HjY8ilZAIEM2tBbPn5mYO1ieIX4= SIaj/6KY3C... MIIE3zCCBEjAUB9...

42 XML Encryption w/ Digital Certificate rsakey.pem IPiEu9Nv+EsGyvV... xrfPSA+BEI+8...

Download ppt "XML Encryption and Authentication March 30, 2006 Robert Richards."

Similar presentations

Ads by Google