XML Encryption: Processing Rules for XML Elements and Content

Slides:



Advertisements
Similar presentations
MPI 2.2 William Gropp. 2 Scope of MPI 2.2 Small changes to the standard. A small change is defined as one that does not break existing correct MPI 2.0.
Advertisements

Advanced XSLT II. Iteration in XSLT we sometimes wish to apply the same transform to a set of nodes we iterate through a node set the node set is defined.
Open Office.Org What is the Open Office.org Source Project? Open source project through which Sun Microsystems is releasing the technology for the popular.
W3C XML Schema: what you might not know (and might or might not like!) Noah Mendelsohn Distinguished Engineer IBM Corp. October 10, 2002.
Topics Acronyms in Action SOAP 6 November 2008 CIS 340.
SE 370: Programming Web Services Week 4: SOAP & NetBeans Copyright © Steven W. Johnson February 1, 2013.
NaLIX: A Generic Natural Language Search Environment for XML Data Presented by: Erik Mathisen 02/12/2008.
XHTML1 Building Document Structure. XHTML2 Objectives In this chapter, you will: Learn how to create Extensible Hypertext Markup Language (XHTML) documents.
1 WSDL Authoring Mike Engelhardt. 2 WSDL Creation Steps Get a copy of someone else’s work Change namespace names Change schema element names Add/remove/rearrange.
1 HTML’s Transition to XHTML. 2 XHTML is the next evolution of HTML Extensible HTML eXtensible based on XML (extensible markup language) XML like HTML.
1 Web Services Security XML Encryption, XML Signature and WS-Security.
XML Encryption: Processing Rules for XML Elements and Content Ed Simon XMLsec Inc. “XML Security Training and Consulting”
® IBM Software Group © 2006 IBM Corporation How to read/write XML using EGL This Learning Module shows how to utilize an EGL Library to read/write an XML.
JSP Standard Tag Library
Pragmatic XML security Hans Granqvist, ApacheCon 2005.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Navigating XML. Overview  Xpath is a non-xml syntax to be used with XSLT and Xpointer. Its purpose according to the W3.org is  to address parts of an.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
XHTML1 Building Document Structure Chapter 2. XHTML2 Objectives In this chapter, you will: Learn how to create Extensible Hypertext Markup Language (XHTML)
XML 1 Enterprise Applications CE00465-M XML. 2 Enterprise Applications CE00465-M XML Overview Extensible Mark-up Language (XML) is a meta-language that.
These Questions are copied from
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XP Tutorial 9 1 Working with XHTML. XP SGML 2 Standard Generalized Markup Language (SGML) A standard for specifying markup languages. Large, complex standard.
XRules An XML Business Rules Language Introduction Copyright © Waleed Abdulla All rights reserved. August 2004.
WEB BASED DATA TRANSFORMATION USING XML, JAVA Group members: Darius Balarashti & Matt Smith.
JSTL Lec Umair©2006, All rights reserved JSTL (ni) Acronym of  JavaServer Pages Standard Tag Library JSTL (like JSP) is a specification, not an.
OTP-ValidationService John Linn, RSA Laboratories 11 May 2005.
AJAX (also known as: XMLHTTP, Remote Scripting, XMLHttpRequest, etc.) Matt Warden.
1 Tutorial 14 Validating Documents with Schemas Exploring the XML Schema Vocabulary.
Tutorial 13 Validating Documents with Schemas
Programming in Java CSCI-2220 Object Oriented Programming.
Enterprise Security API (ESAPI) 2.0 Crypto Changes
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
SIP working group IETF#70 Essential corrections Keith Drage.
1 Class Diagrams. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are for visualizing, specifying and documenting.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
What is SOAP? Luciano Piccoli. SOAP – Simple Object Access Protocol  SOAP is an XML based protocol to let software components and applications communicate.
Securing and Sharing Workbooks Lesson 11. The Review Tab Microsoft Excel provides several layers of security and protection that enable you to control.
C++ Inheritance Data Structures & OO Development I 1 Computer Science Dept Va Tech June 2007 © McQuain Generalization versus Abstraction Abstraction:simplify.
ICM – API Server & Forms Gary Ratcliffe.
1 G52IWS: Web Services Description Language (WSDL) Chris Greenhalgh
XML Schema – XSLT Week 8 Web site:
ESRIN, 15 December 2009 Slide 1 Web Service Security in HMA-T HMA-T Final Presentation 14 December 2009 S. Gianfranceschi, Intecs.
1 XSL Transformations (XSLT). 2 XSLT XSLT is a language for transforming XML documents into XHTML documents or to other XML documents. XSLT uses XPath.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 9 Web Services: JAX-RPC,
JavaScript, Sixth Edition
Unified Modeling Language
WEB SERVICES From Chapter 19 of Distributed Systems Concepts and Design,4th Edition, By G. Coulouris, J. Dollimore and T. Kindberg Published by Addison.
Section 13 - Integrating with Third Party Tools
WORKING WITH NAMESPACES
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Intro to XML.
Data Validation and Protecting Workbook
Content Providers.
XML in Web Technologies
Introduction to C Topics Compilation Using the gcc Compiler
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
draft-ietf-geopriv-lbyr-requirements-02 status update
Advanced Web Services: Soap Headers and more
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
In this session, you will learn to:
Session #, Speaker Name Views 1/2/2019.
Example: LinkedSet<T>
Class Diagrams.
Jonathan Rosenberg dynamicsoft
Deepak Shenoy Agni Software
How to organize and document your classes
WEB SERVICES From Chapter 19, Distributed Systems
Quiz Points 1 Rules Raise your hand if you know the question
InterOp Technical Notes
Presentation transcript:

XML Encryption: Processing Rules for XML Elements and Content

Overview The current XML Encryption Processing Rules (section 4) state that when encrypting an XML document’s child elements or element content, one must replace the plaintext content with <EncryptedData> elements when decrypting, decrypted <EncryptedData> elements (of type Element or Content) must be replaced by the revealed XML If the requirement for replacement is not intentional, we should fix the text. If the requirement is intentional, I propose that it may be too limiting.

Overview… Note: I am not suggesting that XML Encryption specify an API design, absolutely NOT! However, I don’t want XML Encryption to unnecessarily restrict API designs either. Note 2: Slides with detailed code are included for completeness; they are not essential for understanding this topic.

How the current Processing Rules work Original/Decrypted <?xml version="1.0" encoding="UTF-8"?> <Customers> <Customer> <Name>Jose Aznar</Name> <CreditCard> <Number> 1000 1234 5678 0001 </Number> <ExpiryDate> 2003 June 30 </ExpiryDate> </CreditCard> </Customer> . . . </Customers> Encrypted <?xml version="1.0" encoding="UTF-8"?> <Customers> <Customer> <Name><EncryptedData…></Name> <CreditCard> <Number><EncryptedData…></Number> <ExpiryDate> 2003 June 30 </ExpiryDate> </Customer> . . . </Customers>

What the code looks like Encrypting // Encrypt the content of the <CreditCard>/<Number> elements NodeIterator ni2 = XPathAPI.selectNodeIterator(doc,"//CreditCard/Number"); // Encrypt the nodes (only element content is encrypted) while ((node = ni2.nextNode())!= null) { System.out.print("."); xmlencEncryptor.encryptAndReplace((Element)node, true, getEncryptedDataTemplate(desKey, true), desKey); Decrypting // Get the nodes to be decrypted NodeList nl2 = DOMUtil.getElementsByTagNameNS( doc, XEncryption.XMLENC_NS, "EncryptedData"); // Decrypt for (int i = 0; i < nl2.getLength(); i++) { Element el = (Element)nl2.item(i); xmlencDecryptor.decryptAndReplace(el); }

Other processing scenarios Scenario A: The XML source has no encrypted parts and is protected through authorization instead. However, there is an authorized app which selects certain credit card info for processing. It wants to query <CreditCard> elements and/or content, encrypt, and import the resulting <EncryptedData> element into a SOAP message. Scenario B: The XML source has encrypted elements and content accessible by a number of applications. When one of these applications queries an encrypted element, that app needs to decrypt the element but MUST NOT modify the source.

Scenario A: SOAP msg w/ encrypted data . 1. Select node 3. Form SOAP msg 2. Encrypt node (no replace) and return to application Credit card info app customer.xml (no encryption) SOAP msg Authorization control

Scenario A: SOAP message <?xml version="1.0" encoding="UTF-8"?> <Envelope xmlns="http://www.w3.org/2001/06/soap-envelope"> <Body> <VerifyCreditCardRequest xmlns="http://…/actions"> <EncryptedData Type="NodeList“ xmlns="http://…/xmlenc"> <EncryptionMethod Algorithm="urn:nist-gov:tripledes…"> <IV>adCwS3wowQ8=</IV> </EncryptionMethod> …<CipherData>Ynj…M1f</CipherData>… </EncryptedData> </VerifyCreditCardRequest> </Body> </Envelope>

Scenario A code Encrypting // Encrypt the content of the 2nd <CreditCard>/<Number> element nodeToBeEncrypted = XPathAPI.selectSingleNode(doc, "//Customer[2]/CreditCard/Number"); // Encrypt the nodes (whole elements are encrypted) Element elemEncryptedData = xmlencEncryptor.encrypt((Element)nodeToBeEncrypted, false, getEncryptedDataTemplate(desKey, false), desKey); Document docSoap = new DocumentImpl(); Element elemEnvelope = docSoap.createElement("Envelope"); Element elemBody = docSoap.createElement("Body"); Element elemBodyChild = docSoap.createElement("VerifyCreditCardRequest"); Node nodeImported = docSoap.importNode(elemEncryptedData, true); elemBodyChild.appendChild(nodeImported); elemBody.appendChild(elemBodyChild); elemEnvelope.appendChild(elemBody); docSoap.appendChild(elemEnvelope);

Scenario A code… Note: The preceding code works (uses IBM’s XSS4J) but, according to the spec, its illegal because the XML source is not being replaced.

Scenario B: Encrypted customer DB . Customer name: H. Lu Credit card#: 4011 23 1. Select <EncryptedData> node 3. Display info to authorized user 2. Decrypt node (no replace) and return to application Interface to authorized user Credit card info app customer.xml (encrypted)

Scenario B code Decrypting // Get the nodes to be decrypted Element elemEncryptedDataToDecrypt = (Element) DOMUtil.getElementsByTagNameNS(doc, XEncryption.XMLENC_NS, "EncryptedData").item(5); Element elemIV = (Element) elemEncryptedDataToDecrypt.getElementsByTagName("IV").item(0); String strIV = elemIV.getFirstChild().getNodeValue(); Element elemCipherData = (Element) elemEncryptedDataToDecrypt.getElementsByTagName("CipherText").item(0); String strCipherData = elemCipherData.getFirstChild().getNodeValue(); javax.crypto.spec.IvParameterSpec ivparmspec = new javax.crypto.spec.IvParameterSpec(com.ibm.xml.dsig.Base64.decode(strIV)); Cipher desCipher = Cipher.getInstance("DESede/CBC/PKCS5Padding"); desCipher.init(Cipher.DECRYPT_MODE, desKey, ivparmspec); byte[] bytesPlainData = desCipher.doFinal(com.ibm.xml.dsig.Base64.decode(strCipherData)); String strCreditCardNumber = new String(bytesPlainData);

Scenario B code… Don’t want to use decryptAndReplace() because I don’t want to modify the XML source. But XML Encryption doesn’t allow Toolkits to give me an alternative so I have to use low-level security APIs instead! Rather, XML Encryption should allow Toolkits to return the decrypted XML element or content without requiring replacement in the source.

QAQ (Quietly Anticipated Questions) Question: Why not create a dummy document before and/or after encrypting? Answer: Yes, one could create a dummy document and copy in the relevant elements before encrypting or decrypting and still conform to the XML Encryption spec as it currently stands. However, this would be inefficient and often inelegant. Question: The example code you showed doesn’t deal with more complex context situations such as inherited namespaces, default attributes, etc.. How will those artifacts affect the no-replacement processing of <EncryptedData> elements? Answer: I think this question will only be answered through more coding and application experience. There could be some issues that arise.