- XML Reference Guide
- Overview
- What Is XML?
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Table of Contents
- The Document Object Model
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- DOM and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Implementations
- DOM and JavaScript
- Using a Repeater
- Repeaters and XML
- Repeater Resources
- DOM and .NET
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Downloads
- DOM and C++
- DOM and C++ Resources
- DOM and Perl
- DOM and Perl Resources
- DOM and PHP
- DOM and PHP Resources
- DOM Level 3
- DOM Level 3 Core
- DOM Level 3 Load and Save
- DOM Level 3 XPath
- DOM Level 3 Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- The Simple API for XML (SAX)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SAX and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- SAX and .NET
- Informit Articles and Sample Chapters
- SAX and Perl
- SAX and Perl Resources
- SAX and PHP
- SAX and PHP Resources
- Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Document Type Definitions (DTDs)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Schemas
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- RELAX NG
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Schematron
- Official Documentation and Implementations
- Validation in Applications
- Informit Articles and Sample Chapters
- Books and e-Books
- XSL Transformations (XSLT)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XSLT in Java
- Java in XSLT Resources
- XSLT and RSS in .NET
- XSLT and RSS in .NET Resources
- XSL-FO
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XPath
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Base
- Informit Articles and Sample Chapters
- Official Documentation
- XHTML
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XHTML 2.0
- Documentation
- Cascading Style Sheets
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XUL
- XUL References
- XML Events
- XML Events Resources
- XML Data Binding
- Informit Articles and Sample Chapters
- Books and e-Books
- Specifications
- Implementations
- XML and Databases
- Informit Articles and Sample Chapters
- Books and e-Books
- Online Resources
- Official Documentation
- SQL Server and FOR XML
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- Service Oriented Architecture
- Web Services
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Creating a Perl Web Service Client
- SOAP::Lite
- Amazon Web Services
- Creating the Movable Type Plug-in
- Perl, Amazon, and Movable Type Resources
- Apache Axis2
- REST
- REST Resources
- SOAP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SOAP and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- WSDL
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- UDDI
- UDDI Resources
- XML-RPC
- XML-RPC in PHP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Ajax
- Asynchronous Javascript
- Client-side XSLT
- SAJAX and PHP
- Ajax Resources
- JSON
- Ruby on Rails
- Creating Objects
- Ruby Basics: Arrays and Other Sundry Bits
- Ruby Basics: Iterators and Persistence
- Starting on the Rails
- Rails and Databases
- Rails: Ajax and Partials
- Rails Resources
- Web Services Security
- Web Services Security Resources
- SAML
- Informit Articles and Sample Chapters
- Books and e-Books
- Specification and Implementation
- XML Digital Signatures
- XML Digital Signatures Resources
- XML Key Management Services
- Resources for XML Key Management Services
- Internationalization
- Resources
- Grid Computing
- Grid Resources
- Web Services Resource Framework
- Web Services Resource Framework Resources
- WS-Addressing
- WS-Addressing Resources
- WS-Notifications
- New Languages: XML in Use
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Google Web Toolkit
- GWT Basic Interactivity
- Google Sitemaps
- Google Sitemaps Resources
- Accessibility
- Web Accessibility
- XML Accessibility
- Accessibility Resources
- The Semantic Web
- Defining a New Ontology
- OWL: Web Ontology Language
- Semantic Web Resources
- Google Base
- Microformats
- StructuredBlogging
- Live Clipboard
- WML
- XHTML-MP
- WML Resources
- Google Web Services
- Google Web Services API
- Google Web Services Resources
- The Yahoo! Web Services Interface
- Yahoo! Web Services and PHP
- Yahoo! Web Services Resources
- eBay REST API
- WordML
- WordML Part 2: Lists
- WordML Part 3: Tables
- WordML Resources
- DocBook
- Articles
- Books and e-Books
- Official Documentation and Implementations
- XML Query
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XForms
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Resource Description Framework (RDF)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Topic Maps
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation, Implementations, and Other Resources
- Rich Site Summary (RSS)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Simple Sharing Extensions (SSE)
- Atom
- Podcasting
- Podcasting Resources
- Scalable Vector Graphics (SVG)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- OPML
- OPML Resources
- Summary
- Projects
- JavaScript TimeTracker: JSON and PHP
- The Javascript Timetracker
- Refactoring to Javascript Objects
- Creating the Yahoo! Widget
- Web Mashup
- Google Maps
- Indeed Mashup
- Mashup Part 3: Putting It All Together
- Additional Resources
- Frequently Asked Questions About XML
- What's XML, and why should I use it?
- What's a well-formed document?
- What's the difference between XML and HTML?
- What's the difference between HTML and XHTML?
- Can I use XML in a browser?
- Should I use elements or attributes for my document?
- What's a namespace?
- Where can I get an XML parser?
- What's the difference between a well-formed document and a valid document?
- What's a validating parser?
- Should I use DOM or SAX for my application?
- How can I stop a SAX parser before it has parsed the entire document?
- 2005 Predictions
- 2006 Predictions
- Nick's Book Picks
First off, let's look at what XML Key Management Services, or XKMS, is for.
When you're sending (allegedly) secure web services messages, you need a way to verify signatures or obtain public keys to verify the identity of the sender. XML Key Management Services is a way to formalize the way you handle that process. It's independent of the type of key or encryption (such as X.509) and the protocol, although a conforming implementation must work over HTTP with SOAP. (You can implement other protocols as well, however.)
XKMS consists of two parts: the Key Information Service (X-KISS) and the Key Registration Service (X-KRSS).
The Key Information Service provides a way in which an application can delegate the actual work of
requesting or verifying an ID. The message includes the ds:KeyInfo
element, which itself
includes either the key or a URL that points to the key, and the application acts as an X-KISS client,
simply requesting the appropriate information. One advantage of working things this way is that the
web service and the web service client can use different trust schemes.
In order for X-KISS to work, however, we have to establish the way in which keys will be managed and stored. That's where the Key Registration Service comes in. X-KRSS enables a client to request the generation of a public and private key, or even that information such as a name or other attributes be bound to a private key. X-KRSS also provides for the registration, revocation or recovery of keys.
XKMS requests can by synchronous, meaning that the client waits for a response, or asynchronous, meaning that it "calls back" for a response later. The latter has the advantage that an administrator can intervene. For example, as the specification mentions, an administrator might have to approve all key generation requests. Let's take a look at the different types of requests and the XML messages involved behind the scenes.
In a synchronous request, the request itself specifies an identifier for the message, the service it's using, what kind of information it wants back, and the appropriate key information:
<soap:Envelope> <soap:Body> <LocateRequest Id="I6d995b8d05a9a2ce0573d29e32ab9441" Service="http://test.xmltrustcenter.org/XKMS" xmlns="http://www.w3.org/2002/03/xkms#"> <RespondWith>KeyValue</RespondWith> <QueryKeyBinding> <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> <X509Data> <X509Certificate>MIICEDCCAX2gAwIB...==</X509Certificate> </X509Data> </KeyInfo> <KeyUsage>Signature</KeyUsage> </QueryKeyBinding> </LocateRequest> </soap:Body> </soap:Envelope>
The server responds with a result that references the original request ID:
<soap:Envelope> <soap:Body> <LocateResult Id="I69044d458e0bceef5f78c79c32fa9ddf" Service="http://test.xmltrustcenter.org/XKMS" ResultMajor="Success" RequestId="I6d995b8d05a9a2ce0573d29e32ab9441"> ... </LocateResult> </soap:Body> </soap:Envelope>
The response carries a "major" and a "minor" response.
For an asynchronous request, there's an extra step. The request specifies that it's not expecting an immediate
answer by specifying that the ResponseMechanism
is Pending
:
<soap:Envelope> <soap:Body> <LocateRequest Id="I6227979ae4073f2b3b145db7a488ce16" Service="http://test.xmltrustcenter.org/XKMS" xmlns="http://www.w3.org/2002/03/xkms#"> <ResponseMechanism>Pending</ResponseMechanism> ... </LocateRequest> </soap:Body> </soap:Envelope>
The server responds with an acknowledgement of the request, specifying that the result is Pending
:
<soap:Envelope> <soap:Body> <LocateResult Id="I98366e407a2a78dff79687dbdb4d974c" Service="http://test.xmltrustcenter.org/XKMS" ResultMajor="Pending" RequestId="I6227979ae4073f2b3b145db7a488ce16" xmlns="http://www.w3.org/2002/03/xkms#" /> </soap:Body> </soap:Envelope>
The client waits for notification that the response is ready. According to the specification, the notification comes in the form:
<soap:Envelope> <soap:Body> <Result xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns="http://www.w3.org/2002/03/xkms#"/> </soap:Body> </soap:Envelope>
Once the client receives the notification, it requests the result from the server:
<soap:Envelope> <soap:Body> <PendingRequest Id="I6045ff8b2eb204edb538be1fa22e340a" Service="http://test.xmltrustcenter.org/XKMS" OriginalRequestId="I6227979ae4073f2b3b145db7a488ce16" ResponseId="I98366e407a2a78dff79687dbdb4d974c" xmlns="http://www.w3.org/2002/03/xkms#" /> </soap:Body> </soap:Envelope>
XKMS also provides for a third method of processing. This third method is called the Two Phase Request Protocol, and is intended to help prevent denial of service attacks. In this case, the client must first provide simple authentication proving it has access to the system in the first place before it can request a more intensive operation. For example, the first request comes in with a ResponseMechanism
of Represent
:
<soap:Envelope> <soap:Body> <LocateRequest Id="Ia1d6ca7a067fdd545f1a1396d2f26779" Service="http://test.xmltrustcenter.org/XKMS" xmlns="http://www.w3.org/2002/03/xkms#"> <ResponseMechanism>Represent</ResponseMechanism> ...(authentication information)... </LocateRequest> </soap:Body> </soap:Envelope>
The server responds with a new value, Nonce
, that shows that permission's been granted:
<soap:Envelope> <soap:Body> <LocateResult Id="Idbc77142059a3a51c9eccd2425d77757" Service="http://test.xmltrustcenter.org/XKMS" Nonce="Rj2BoUZM7PisPX2ytSAAWA==" ResultMajor="Represent" RequestId="Ia1d6ca7a067fdd545f1a1396d2f26779" xmlns="http://www.w3.org/2002/03/xkms#" /> </soap:Body> </soap:Envelope>
The client can then make the actual request, which includes not only the Nonce
and
original request ID, but also its own ID:
<soap:Envelope> <soap:Body> <LocateRequest Id="I47804adaec32e34afeecdb51f3e0f765" Service="http://test.xmltrustcenter.org/XKMS" Nonce="Rj2BoUZM7PisPX2ytSAAWA==" OriginalRequestId="Ia1d6ca7a067fdd545f1a1396d2f26779" xmlns="http://www.w3.org/2002/03/xkms#"> ... </LocateRequest> </soap:Body> </soap:Envelope>
Finally, the server sends the response, which is keyed to the second request:
<soap:Envelope> <soap:Body> <LocateResult Id="I3b0111d2232507a56444c1bc85409a94" Service="http://test.xmltrustcenter.org/XKMS" ResultMajor="Success" RequestId="I47804adaec32e34afeecdb51f3e0f765" xmlns="http://www.w3.org/2002/03/xkms#" /> </soap:Body> </soap:Envelope>
A client can also use the Two Phase Protocol with an asynchronous request. The specification also provides for complex messaging, in which a single message contains more than one request and the server batches all of the results into a single response.
XML Key Management Services 2.0 is currently at the Candidate Recommendation level. Once it advances to Recommendation status, look to this space for an example of using an XKMS implementation.