XML Encryption: Processing Rules for XML Elements and Content Ed Simon XMLsec Inc. “XML Security Training and Consulting”

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 6-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Advertisements

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.
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.
LiNC Developer Meetup Welcome!. Our job is to make your life easier APIs Tools and workflow Documentation Stay in touch: developers.lithium.com Join the.
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
XML Data Bill la Forge, CTO JXML, Inc.  JXML, Inc All Rights Reserved January 18, 2000 The JXML Vision.
Confidential property of Belkin International. Unlawful to copy or reproduce in any manner without the express written consent of Belkin International.
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.
XML Schemas and Namespaces Lecture 11, 07/10/02. BookStore.dtd.
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.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
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.
Document Type Definitions. XML and DTDs A DTD (Document Type Definition) describes the structure of one or more XML documents. Specifically, a DTD describes:
1 Web Services Security XML Encryption, XML Signature and WS-Security.
Introduction To Databases IDIA 618 Fall 2014 Bridget M. Blodgett.
® 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
Internet Skills An Introduction to HTML Alan Noble Room 504 Tel: (44562 internal)
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.
Requirements Analysis
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.
Web Services MnSCU Web Services Roundtable David Purcell, OoC IT JoDee Haugrud, MN State Moorhead Gary Hayden-Sofio, MCTC Dave Kruse, SCTC.
These Questions are copied from
FIGIS’ML Hands-on training - © FAO/FIGIS An introduction to XML Objectives : –what is XML? –XML and HTML –XML documents structure well-formedness.
Intro to XML Originally Presented by Clifford Lemoine Modified by Box.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XML Patch Operations based on XPath selectors Jari Urpalainen IETF62 Minneapolis.
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.
14-1 JXTA for J2ME Learning Objectives ● This module will help you... – Learn about the architecture of JXTA for J2ME – Learn the JXTA for J2ME.
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
Enterprise Security API (ESAPI) 2.0 Crypto Changes
XP New Perspectives on XML, 2 nd Edition Tutorial 8 1 TUTORIAL 8 CREATING ELEMENT GROUPS.
Copyright © 2006 Pilothouse Consulting Inc. All rights reserved. Search Overview Search Features: WSS and Office Search Architecture Content Sources and.
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.
Secure Online Payment Presented by Tom Hun Web Developer.
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.
When we create.rtf document apart from saving the actual info the tool saves additional info like start of a paragraph, bold, size of the font.. Etc. This.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
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.
Mr C Johnston ICT Teacher
® IBM Software Group © 2009 IBM Corporation Essentials of Modeling with the IBM Rational Software Architect, V7.5 Module 15: Traceability and Static Analysis.
CSE300 EAIusing EJB & XML CSE Enterprise Application Integration Using EJB and XML by Prithwis Sett Mumtaz Lohawala Nayana Paranjape.
Martin Kruliš by Martin Kruliš (v1.1)1.
Securing Web Applications Lesson 4B / Slide 1 of 34 J2EE Web Components Pre-assessment Questions 1. Identify the correct return type returned by the doStartTag()
Energy Balancing Credit Variation Proposal Modification 0233 Transmission Work Stream 5th March 2009 Mark Cockayne.
XML Extensible Markup Language
XML Schema – XSLT Week 8 Web site:
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,
Content Providers.
XML in Web Technologies
XML Encryption: Processing Rules for XML Elements and Content
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
Session #, Speaker Name Views 1/2/2019.
Class Diagrams.
How to organize and document your classes
InterOp Technical Notes
Presentation transcript:

XML Encryption: Processing Rules for XML Elements and Content Ed Simon XMLsec Inc. “XML Security Training and Consulting”

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 elements –when decrypting, decrypted 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 Jose Aznar June Encrypted 2003 June 30...

What the code looks like Encrypting // Encrypt the content of the / 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++) { System.out.print("."); 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 elements and/or content, encrypt, and import the resulting 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. SOAP msg customer.xml (no encryption) Authorization control 1. Select node 2. Encrypt node (no replace) and return to application 3. Form SOAP msg Credit card info app

Scenario A: SOAP message adCwS3wowQ8= … Ynj…M1f …

Scenario A code Encrypting // Encrypt the content of the 2nd / 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 1. Select node. Interface to authorized user customer.xml (encrypted) Credit card info app Customer name: H. Lu Credit card#: Display info to authorized user 2. Decrypt node (no replace) and return to application

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 elements? Answer: I think this question will only be answered through more coding and application experience. There could be some issues that arise.