3 XMPP Working Group P. Saint-Andre (ed.)
4 Internet-Draft Jabber Software Foundation
5 Expires: September 17, 2004 March 19, 2004
8 Extensible Messaging and Presence Protocol (XMPP): Core
9 draft-ietf-xmpp-core-22
13 This document is an Internet-Draft and is in full conformance with
14 all provisions of Section 10 of RFC2026.
16 Internet-Drafts are working documents of the Internet Engineering
17 Task Force (IETF), its areas, and its working groups. Note that other
18 groups may also distribute working documents as Internet-Drafts.
20 Internet-Drafts are draft documents valid for a maximum of six months
21 and may be updated, replaced, or obsoleted by other documents at any
22 time. It is inappropriate to use Internet-Drafts as reference
23 material or to cite them other than as "work in progress."
25 The list of current Internet-Drafts can be accessed at http://
26 www.ietf.org/ietf/1id-abstracts.txt.
28 The list of Internet-Draft Shadow Directories can be accessed at
29 http://www.ietf.org/shadow.html.
31 This Internet-Draft will expire on September 17, 2004.
35 Copyright (C) The Internet Society (2004). All Rights Reserved.
39 This memo defines the core features of the Extensible Messaging and
40 Presence Protocol (XMPP), a protocol for streaming Extensible Markup
41 Language (XML) elements in order to exchange structured information
42 in close to real time between any two network endpoints. While XMPP
43 provides a generalized, extensible framework for exchanging XML data,
44 it is used mainly for the purpose of building instant messaging and
45 presence applications that meet the requirements of RFC 2779.
55 Saint-Andre (ed.) Expires September 17, 2004 [Page 1]
57 Internet-Draft XMPP Core March 2004
62 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3
63 2. Generalized Architecture . . . . . . . . . . . . . . . . . . . 4
64 3. Addressing Scheme . . . . . . . . . . . . . . . . . . . . . . 5
65 4. XML Streams . . . . . . . . . . . . . . . . . . . . . . . . . 8
66 5. Use of TLS . . . . . . . . . . . . . . . . . . . . . . . . . . 20
67 6. Use of SASL . . . . . . . . . . . . . . . . . . . . . . . . . 26
68 7. Resource Binding . . . . . . . . . . . . . . . . . . . . . . . 37
69 8. Server Dialback . . . . . . . . . . . . . . . . . . . . . . . 40
70 9. XML Stanzas . . . . . . . . . . . . . . . . . . . . . . . . . 47
71 10. Server Rules for Handling XML Stanzas . . . . . . . . . . . . 56
72 11. XML Usage within XMPP . . . . . . . . . . . . . . . . . . . . 59
73 12. Core Compliance Requirements . . . . . . . . . . . . . . . . . 61
74 13. Internationalization Considerations . . . . . . . . . . . . . 63
75 14. Security Considerations . . . . . . . . . . . . . . . . . . . 63
76 15. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 68
77 Normative References . . . . . . . . . . . . . . . . . . . . . 71
78 Informative References . . . . . . . . . . . . . . . . . . . . 73
79 Author's Address . . . . . . . . . . . . . . . . . . . . . . . 74
80 A. Nodeprep . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
81 B. Resourceprep . . . . . . . . . . . . . . . . . . . . . . . . . 76
82 C. XML Schemas . . . . . . . . . . . . . . . . . . . . . . . . . 78
83 D. Differences Between Core Jabber Protocols and XMPP . . . . . . 86
84 Intellectual Property and Copyright Statements . . . . . . . . 88
111 Saint-Andre (ed.) Expires September 17, 2004 [Page 2]
113 Internet-Draft XMPP Core March 2004
120 The Extensible Messaging and Presence Protocol (XMPP) is an open XML
121 [XML] protocol for near-real-time messaging, presence, and
122 request-response services. The basic syntax and semantics were
123 developed originally within the Jabber open-source community, mainly
124 in 1999. In 2002, the XMPP WG was chartered with developing an
125 adaptation of the Jabber protocol that would be suitable as an IETF
126 instant messaging (IM) and presence technology. As a result of work
127 by the XMPP WG, the current memo defines the core features of XMPP;
128 the extensions required to provide the instant messaging and presence
129 functionality defined in RFC 2779 [IMP-REQS] are specified in
130 Extensible Messaging and Presence Protocol (XMPP): Instant Messaging
131 and Presence [XMPP-IM].
135 The capitalized key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
136 "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
137 "OPTIONAL" in this document are to be interpreted as described in RFC
142 Most of the core aspects of the Extensible Messaging and Presence
143 Protocol were developed originally within the Jabber open-source
144 community in 1999. This community was founded by Jeremie Miller, who
145 released source code for the initial version of the jabberd server in
146 January 1999. Major early contributors to the base protocol also
147 included Ryan Eatmon, Peter Millard, Thomas Muldowney, and Dave
148 Smith. Work by the XMPP Working Group has concentrated especially on
149 security and internationalization; in these areas, protocols for the
150 use of TLS and SASL were originally contributed by Rob Norris, and
151 stringprep profiles were originally contributed by Joe Hildebrand.
152 The error code syntax was suggested by Lisa Dusseault.
156 Thanks are due to a number of individuals in addition to the
157 contributors listed. Although it is difficult to provide a complete
158 list, the following individuals were particularly helpful in defining
159 the protocols or in commenting on the specifications in this memo:
160 Thomas Charron, Richard Dobson, Sam Hartman, Schuyler Heath, Jonathan
161 Hogg, Cullen Jennings, Craig Kaes, Jacek Konieczny, Alexey Melnikov,
162 Keith Minkler, Julian Missig, Pete Resnick, Marshall Rose, Alexey
163 Shchepin, Jean-Louis Seguineau, Iain Shigeoka, Greg Troxel, and David
167 Saint-Andre (ed.) Expires September 17, 2004 [Page 3]
169 Internet-Draft XMPP Core March 2004
172 Waite. Thanks also to members of the XMPP Working Group and the IETF
173 community for comments and feedback provided throughout the life of
176 2. Generalized Architecture
180 Although XMPP is not wedded to any specific network architecture, to
181 date it usually has been implemented via a client-server architecture
182 wherein a client utilizing XMPP accesses a server over a [TCP]
183 connection, and servers also communicate with each other over TCP
186 The following diagram provides a high-level overview of this
187 architecture (where "-" represents communications that use XMPP and
188 "=" represents communications that use any other protocol).
192 C2----+--G1===FN1===FC1
194 The symbols are as follows:
196 o C1, C2, C3 = XMPP clients
198 o S1, S2 = XMPP servers
200 o G1 = A gateway that translates between XMPP and the protocol(s)
201 used on a foreign (non-XMPP) messaging network
203 o FN1 = A foreign messaging network
205 o FC1 = A client on a foreign messaging network
210 A server acts as an intelligent abstraction layer for XMPP
211 communications. Its primary responsibilities are:
213 o to manage connections from or sessions for other entities, in the
214 form of XML streams (Section 4) to and from authorized clients,
215 servers, and other entities
217 o to route appropriately-addressed XML stanzas (Section 9) among
218 such entities over XML streams
223 Saint-Andre (ed.) Expires September 17, 2004 [Page 4]
225 Internet-Draft XMPP Core March 2004
228 Most XMPP-compliant servers also assume responsibility for the
229 storage of data that is used by clients (e.g., contact lists for
230 users of XMPP-based instant messaging and presence applications); in
231 this case, the XML data is processed directly by the server itself on
232 behalf of the client and is not routed to another entity.
236 Most clients connect directly to a server over a [TCP] connection and
237 use XMPP to take full advantage of the functionality provided by a
238 server and any associated services. Multiple resources (e.g.,
239 devices or locations) MAY connect simultaneously to a server on
240 behalf of each authorized client, with each resource differentiated
241 by the resource identifier of an XMPP address (e.g., <node@domain/
242 home> vs. <node@domain/work>) as defined under Addressing Scheme
243 (Section 3). The RECOMMENDED port for connections between a client
244 and a server is 5222, as registered with the IANA (see Port Numbers
249 A gateway is a special-purpose server-side service whose primary
250 function is to translate XMPP into the protocol used by a foreign
251 (non-XMPP) messaging system, as well as to translate the return data
252 back into XMPP. Examples are gateways to email (see [SMTP]),
253 Internet Relay Chat (see [IRC]), SIMPLE (see [SIMPLE]), Short Message
254 Service (SMS), and legacy instant messaging services such as AIM,
255 ICQ, MSN Messenger, and Yahoo! Instant Messenger. Communications
256 between gateways and servers, and between gateways and the foreign
257 messaging system, are not defined in this document.
261 Because each server is identified by a network address and because
262 server-to-server communications are a straightforward extension of
263 the client-to-server protocol, in practice the system consists of a
264 network of servers that inter-communicate. Thus, for example,
265 <juliet@example.com> is able to exchange messages, presence, and
266 other information with <romeo@example.net>. This pattern is familiar
267 from messaging protocols (such as [SMTP]) that make use of network
268 addressing standards. Communications between any two servers are
269 OPTIONAL. If enabled, such communications SHOULD occur over XML
270 streams that are bound to [TCP] connections. The RECOMMENDED port
271 for connections between servers is 5269, as registered with the IANA
272 (see Port Numbers (Section 15.9)).
279 Saint-Andre (ed.) Expires September 17, 2004 [Page 5]
281 Internet-Draft XMPP Core March 2004
286 An entity is anything that can be considered a network endpoint
287 (i.e., an ID on the network) and that can communicate using XMPP.
288 All such entities are uniquely addressable in a form that is
289 consistent with RFC 2396 [URI]. For historical reasons, the address
290 of an XMPP entity is called a Jabber Identifier or JID. A valid JID
291 contains a set of ordered elements formed of a domain identifier,
292 node identifier, and resource identifier.
294 The syntax for a JID is defined below using Augmented Backus-Naur
295 Form as defined in [ABNF]. The IPv4address and IPv6address rules are
296 defined in Appendix B of [IPv6]; the allowable character sequences
297 that conform to the node rule are defined by the Nodeprep (Appendix
298 A) profile of [STRINGPREP] as documented in this memo; the allowable
299 character sequences that conform to the resource rule are defined by
300 the Resourceprep (Appendix B) profile of [STRINGPREP] as documented
301 in this memo; and the sub-domain rule makes reference to the concept
302 of a domain label as described in [IDNA].
304 jid = [ node "@" ] domain [ "/" resource ]
305 domain = fqdn / address-literal
306 fqdn = (sub-domain 1*("." sub-domain))
307 sub-domain = ([IDNA] conformant domain label)
308 address-literal = IPv4address / IPv6address
310 All JIDs are based on the foregoing structure. The most common use
311 of this structure is to identify an instant messaging user, the
312 server to which the user connects, and the user's connected resource
313 (e.g., a specific client) in the form of <user@host/resource>.
314 However, node types other than clients are possible; for example, a
315 specific chat room offered by a multi-user chat service could be
316 addressed as <room@service> (where "room" is the name of the chat
317 room and "service" is the hostname of the multi-user chat service)
318 and a specific occupant of such a room could be addressed as
319 <room@service/nick> (where "nick" is the occupant's room nickname).
320 Many other JID types are possible (e.g., <domain/resource> could be a
321 server-side script or service).
323 Each allowable portion of a JID (node identifier, domain identifier,
324 and resource identifier) MUST NOT be more than 1023 bytes in length,
325 resulting in a maximum total size (including the '@' and '/'
326 separators) of 3071 bytes.
328 3.2 Domain Identifier
330 The domain identifier is the primary identifier and is the only
331 REQUIRED element of a JID (a mere domain identifier is a valid JID).
335 Saint-Andre (ed.) Expires September 17, 2004 [Page 6]
337 Internet-Draft XMPP Core March 2004
340 It usually represents the network gateway or "primary" server to
341 which other entities connect for XML routing and data management
342 capabilities. However, the entity referenced by a domain identifier
343 is not always a server, and may be a service that is addressed as a
344 subdomain of a server and that provides functionality above and
345 beyond the capabilities of a server (e.g., a multi-user chat service,
346 a user directory, or a gateway to a foreign messaging system).
348 The domain identifier for every server or service that will
349 communicate over a network MAY be an IP address but SHOULD be a fully
350 qualified domain name (see [DNS]). A domain identifier MUST be an
351 "internationalized domain name" as defined in [IDNA], to which the
352 Nameprep [NAMEPREP] profile of stringprep [STRINGPREP] can be applied
353 without failing. Before comparing two domain identifiers, a server
354 MUST (and a client SHOULD) first apply the Nameprep profile to the
355 labels (as defined in [IDNA]) that make up each identifier.
359 The node identifier is an optional secondary identifier placed before
360 the domain identifier and separated from the latter by the '@'
361 character. It usually represents the entity requesting and using
362 network access provided by the server or gateway (i.e., a client),
363 although it can also represent other kinds of entities (e.g., a chat
364 room associated with a multi-user chat service). The entity
365 represented by a node identifier is addressed within the context of a
366 specific domain; within instant messaging and presence applications
367 of XMPP this address is called a "bare JID" and is of the form
370 A node identifier MUST be formatted such that the Nodeprep (Appendix
371 A) profile of [STRINGPREP] can be applied to it without failing.
372 Before comparing two node identifiers, a server MUST (and a client
373 SHOULD) first apply the Nodeprep profile to each identifier.
375 3.4 Resource Identifier
377 The resource identifier is an optional tertiary identifier placed
378 after the domain identifier and separated from the latter by the '/'
379 character. A resource identifier may modify either a <node@domain>
380 or mere <domain> address. It usually represents a specific session,
381 connection (e.g., a device or location), or object (e.g., a
382 participant in a multi-user chat room) belonging to the entity
383 associated with a node identifier. A resource identifier is opaque
384 to both servers and other clients, and is typically defined by a
385 client implementation when it provides the information necessary to
386 complete Resource Binding (Section 7) (although it may be generated
387 by a server on behalf of a client), after which it is referred to as
391 Saint-Andre (ed.) Expires September 17, 2004 [Page 7]
393 Internet-Draft XMPP Core March 2004
396 a "connected resource". An entity MAY maintain multiple connected
397 resources simultaneously, with each connected resource differentiated
398 by a distinct resource identifier.
400 A resource identifier MUST be formatted such that the Resourceprep
401 (Appendix B) profile of [STRINGPREP] can be applied to it without
402 failing. Before comparing two resource identifiers, a server MUST
403 (and a client SHOULD) first apply the Resourceprep profile to each
406 3.5 Determination of Addresses
408 After SASL negotiation (Section 6) and, if appropriate, Resource
409 Binding (Section 7), the receiving entity for a stream MUST determine
410 the initiating entity's JID.
412 For server-to-server communications, the initiating entity's JID
413 SHOULD be the authorization identity, derived from the authentication
414 identity as defined by the Simple Authentication and Security Layer
415 (SASL) specification [SASL] if no authorization identity was
416 specified during SASL negotiation (Section 6).
418 For client-to-server communications, the "bare JID" (<node@domain>)
419 SHOULD be the authorization identity, derived from the authentication
420 identity as defined in [SASL] if no authorization identity was
421 specified during SASL negotiation (Section 6); the resource
422 identifier portion of the "full JID" (<node@domain/resource>) SHOULD
423 be the resource identifier negotiated by the client and server during
424 Resource Binding (Section 7).
426 The receiving entity MUST ensure that the resulting JID (including
427 node identifier, domain identifier, resource identifier, and
428 separator characters) conforms to the rules and formats defined
429 earlier in this section; to meet this restriction, the receiving
430 entity may need to replace the JID sent by the initiating entity with
431 the canonicalized JID as determined by the receiving entity.
437 Two fundamental concepts make possible the rapid, asynchronous
438 exchange of relatively small payloads of structured information
439 between presence-aware entities: XML streams and XML stanzas. These
440 terms are defined as follows:
447 Saint-Andre (ed.) Expires September 17, 2004 [Page 8]
449 Internet-Draft XMPP Core March 2004
452 Definition of XML Stream: An XML stream is a container for the
453 exchange of XML elements between any two entities over a network.
454 The start of an XML stream is denoted unambiguously by an opening
455 XML <stream> tag (with appropriate attributes and namespace
456 declarations), while the end of the XML stream is denoted
457 unambiguously by a closing XML </stream> tag. During the life of
458 the stream, the entity that initiated it can send an unbounded
459 number of XML elements over the stream, either elements used to
460 negotiate the stream (e.g., to negotiate use of TLS (Section 5) or
461 use of SASL (Section 6)) or XML stanzas (as defined herein,
462 <message/>, <presence/>, or <iq/> elements qualified by the
463 default namespace). The "initial stream" is negotiated from the
464 initiating entity (usually a client or server) to the receiving
465 entity (usually a server), and can be seen as corresponding to the
466 initiating entity's "session" with the receiving entity. The
467 initial stream enables unidirectional communication from the
468 initiating entity to the receiving entity; in order to enable
469 information exchange from the receiving entity to the initiating
470 entity, the receiving entity MUST negotiate a stream in the
471 opposite direction (the "response stream").
473 Definition of XML Stanza: An XML stanza is a discrete semantic unit
474 of structured information that is sent from one entity to another
475 over an XML stream. An XML stanza exists at the direct child
476 level of the root <stream/> element and is said to be
477 well-balanced if it matches production [43] content of [XML]. The
478 start of any XML stanza is denoted unambiguously by the element
479 start tag at depth=1 of the XML stream (e.g., <presence>), and the
480 end of any XML stanza is denoted unambiguously by the
481 corresponding close tag at depth=1 (e.g., </presence>). An XML
482 stanza MAY contain child elements (with accompanying attributes,
483 elements, and XML character data) as necessary in order to convey
484 the desired information. The only XML stanzas defined herein are
485 the <message/>, <presence/>, and <iq/> elements qualified by the
486 default namespace for the stream, as described under XML Stanzas
487 (Section 9); an XML element sent for the purpose of Transport
488 Layer Security (TLS) negotiation (Section 5), Simple
489 Authentication and Security Layer (SASL) negotiation (Section 6),
490 or server dialback (Section 8) is not considered to be an XML
493 Consider the example of a client's session with a server. In order
494 to connect to a server, a client MUST initiate an XML stream by
495 sending an opening <stream> tag to the server, optionally preceded by
496 a text declaration specifying the XML version and the character
497 encoding supported (see Inclusion of Text Declaration (Section 11.4);
498 see also Character Encoding (Section 11.5)). Subject to local
499 policies and service provisioning, the server SHOULD then reply with
503 Saint-Andre (ed.) Expires September 17, 2004 [Page 9]
505 Internet-Draft XMPP Core March 2004
508 a second XML stream back to the client, again optionally preceded by
509 a text declaration. Once the client has completed SASL negotiation
510 (Section 6), the client MAY send an unbounded number of XML stanzas
511 over the stream to any recipient on the network. When the client
512 desires to close the stream, it simply sends a closing </stream> tag
513 to the server (alternatively, the stream may be closed by the
514 server), after which both the client and server SHOULD terminate the
515 underlying connection (usually a TCP connection) as well.
517 Those who are accustomed to thinking of XML in a document-centric
518 manner may wish to view a client's session with a server as
519 consisting of two open-ended XML documents: one from the client to
520 the server and one from the server to the client. From this
521 perspective, the root <stream/> element can be considered the
522 document entity for each "document", and the two "documents" are
523 built up through the accumulation of XML stanzas sent over the two
524 XML streams. However, this perspective is a convenience only, and
525 XMPP does not deal in documents but in XML streams and XML stanzas.
527 In essence, then, an XML stream acts as an envelope for all the XML
528 stanzas sent during a session. We can represent this in a simplistic
531 |--------------------|
533 |--------------------|
537 |--------------------|
538 | <message to='foo'> |
541 |--------------------|
545 |--------------------|
547 |--------------------|
549 |--------------------|
554 Although there is no necessary coupling of an XML stream to a [TCP]
555 connection (e.g., two entities could connect to each other via
559 Saint-Andre (ed.) Expires September 17, 2004 [Page 10]
561 Internet-Draft XMPP Core March 2004
564 another mechanism such as polling over [HTTP]), this specification
565 defines a binding of XMPP to TCP only. In the context of
566 client-to-server communications, a server MUST allow a client to
567 share a single TCP connection for XML stanzas sent from client to
568 server and from server to client. In the context of server-to-server
569 communications, a server MUST use one TCP connection for XML stanzas
570 sent from the server to the peer and another TCP connection
571 (initiated by the peer) for stanzas from the peer to the server, for
572 a total of two TCP connections.
576 When negotiating XML streams in XMPP 1.0, TLS SHOULD be used as
577 defined under Use of TLS (Section 5) and SASL MUST be used as defined
578 under Use of SASL (Section 6). The "initial stream" (i.e., the
579 stream from the initiating entity to the receiving entity) and the
580 "response stream" (i.e., the stream from the receiving entity to the
581 initiating entity) MUST be secured separately, although security in
582 both directions MAY be established via mechanisms that provide mutual
583 authentication. An entity SHOULD NOT attempt to send XML Stanzas
584 (Section 9) over the stream before the stream has been authenticated,
585 but if it does then the other entity MUST NOT accept such stanzas and
586 SHOULD return a <not-authorized/> stream error and then terminate
587 both the XML stream and the underlying TCP connection; note well that
588 this applies to XML stanzas only (i.e., <message/>, <presence/>, and
589 <iq/> elements scoped by the default namespace) and not to XML
590 elements used for stream negotiation (e.g., elements used to
591 negotiate use of TLS (Section 5) or Use of SASL (Section 6)).
593 4.4 Stream Attributes
595 The attributes of the stream element are as follows:
597 o to -- The 'to' attribute SHOULD be used only in the XML stream
598 header from the initiating entity to the receiving entity, and
599 MUST be set to a hostname serviced by the receiving entity. There
600 SHOULD NOT be a 'to' attribute set in the XML stream header by
601 which the receiving entity replies to the initiating entity;
602 however, if a 'to' attribute is included, it SHOULD be silently
603 ignored by the initiating entity.
605 o from -- The 'from' attribute SHOULD be used only in the XML stream
606 header from the receiving entity to the initiating entity, and
607 MUST be set to a hostname serviced by the receiving entity that is
608 granting access to the initiating entity. There SHOULD NOT be a
609 'from' attribute on the XML stream header sent from the initiating
610 entity to the receiving entity; however, if a 'from' attribute is
611 included, it SHOULD be silently ignored by the receiving entity.
615 Saint-Andre (ed.) Expires September 17, 2004 [Page 11]
617 Internet-Draft XMPP Core March 2004
620 o id -- The 'id' attribute SHOULD be used only in the XML stream
621 header from the receiving entity to the initiating entity. This
622 attribute is a unique identifier created by the receiving entity
623 to function as a session key for the initiating entity's streams
624 with the receiving entity, and MUST be unique within the receiving
625 application (normally a server). Note well that the stream ID may
626 be security-critical and therefore MUST be both unpredictable and
627 nonrepeating (see [RANDOM] for recommendations regarding
628 randomness for security purposes). There SHOULD NOT be an 'id'
629 attribute on the XML stream header sent from the initiating entity
630 to the receiving entity; however, if an 'id' attribute is
631 included, it SHOULD be silently ignored by the receiving entity.
633 o xml:lang -- An 'xml:lang' attribute (as defined in Section 2.12 of
634 [XML]) SHOULD be included by the initiating entity on the header
635 for the initial stream to specify the default language of any
636 human-readable XML character data it sends over that stream. If
637 the attribute is included, the receiving entity SHOULD remember
638 that value as the default for both the initial stream and the
639 response stream; if the attribute is not included, the receiving
640 entity SHOULD use a configurable default value for both streams,
641 which it MUST communicate in the header for the response stream.
642 For all stanzas sent over the initial stream, if the initiating
643 entity does not include an 'xml:lang' attribute, the receiving
644 entity SHOULD apply the default value; if the initiating entity
645 does include an 'xml:lang' attribute, the receiving entity MUST
646 NOT modify or delete it (see also xml:lang (Section 9.1.5)). The
647 value of the 'xml:lang' attribute MUST be an NMTOKEN (as defined
648 in Section 2.3 of [XML]) and MUST conform to the format defined in
651 o version -- The presence of the version attribute set to a value of
652 at least "1.0" signals support for the stream-related protocols
653 (including stream features) defined in this specification.
654 Detailed rules regarding generation and handling of this attribute
657 We can summarize as follows:
659 | initiating to receiving | receiving to initiating
660 ---------+---------------------------+-----------------------
661 to | hostname of receiver | silently ignored
662 from | silently ignored | hostname of receiver
663 id | silently ignored | session key
664 xml:lang | default language | default language
665 version | signals XMPP 1.0 support | signals XMPP 1.0 support
671 Saint-Andre (ed.) Expires September 17, 2004 [Page 12]
673 Internet-Draft XMPP Core March 2004
676 4.4.1 Version Support
678 The version of XMPP specified herein is "1.0"; in particular, this
679 encapsulates the stream-related protocols (Use of TLS (Section 5),
680 Use of SASL (Section 6), and Stream Errors (Section 4.7)) as well as
681 the semantics of the three defined XML stanza types (<message/>,
682 <presence/>, and <iq/>). The numbering scheme for XMPP versions is
683 "<major>.<minor>". The major and minor numbers MUST be treated as
684 separate integers and each number MAY be incremented higher than a
685 single digit. Thus, "XMPP 2.4" would be a lower version than "XMPP
686 2.13", which in turn would be lower than "XMPP 12.3". Leading zeros
687 (e.g., "XMPP 6.01") MUST be ignored by recipients and MUST NOT be
690 The major version number should be incremented only if the stream and
691 stanza formats or required actions have changed so dramatically that
692 an older version entity would not be able to interoperate with a
693 newer version entity if it simply ignored the elements and attributes
694 it did not understand and took the actions specified in the older
695 specification. The minor version number indicates new capabilities,
696 and MUST be ignored by an entity with a smaller minor version number,
697 but used for informational purposes by the entity with the larger
698 minor version number. For example, a minor version number might
699 indicate the ability to process a newly defined value of the 'type'
700 attribute for message, presence, or IQ stanzas; the entity with the
701 larger minor version number would simply note that its correspondent
702 would not be able to understand that value of the 'type' attribute
703 and therefore would not send it.
705 The following rules apply to the generation and handling by
706 implementations of the 'version' attribute within stream headers:
708 1. The initiating entity MUST set the value of the 'version'
709 attribute on the initial stream header to the highest version
710 number it supports (e.g., if the highest version number it
711 supports is that defined in this specification, it MUST set the
714 2. The receiving entity MUST set the value of the 'version'
715 attribute on the response stream header to either the value
716 supplied by the initiating entity or the highest version number
717 supported by the receiving entity, whichever is lower. The
718 receiving entity MUST perform a numeric comparison on the major
719 and minor version numbers, not a string match on
722 3. If the version number included in the response stream header is
723 at least one major version lower than the version number included
727 Saint-Andre (ed.) Expires September 17, 2004 [Page 13]
729 Internet-Draft XMPP Core March 2004
732 in the initial stream header and newer version entities cannot
733 interoperate with older version entities as described above, the
734 initiating entity SHOULD generate an <unsupported-version/>
735 stream error and terminate the XML stream and underlying TCP
738 4. If either entity receives a stream header with no 'version'
739 attribute, the entity MUST consider the version supported by the
740 other entity to be "0.0" and SHOULD NOT include a 'version'
741 attribute in the stream header it sends in reply.
744 4.5 Namespace Declarations
746 The stream element MUST possess both a streams namespace declaration
747 and a default namespace declaration (as "namespace declaration" is
748 defined in the XML namespaces specification [XML-NAMES]). For
749 detailed information regarding the streams namespace and default
750 namespace, see Namespace Names and Prefixes (Section 11.2).
754 If the initiating entity includes the 'version' attribute set to a
755 value of at least "1.0" in the initial stream header, the receiving
756 entity MUST send a <features/> child element (prefixed by the streams
757 namespace prefix) to the initiating entity in order to announce any
758 stream-level features that can be negotiated (or capabilities that
759 otherwise need to be advertised). Currently this is used only to
760 advertise Use of TLS (Section 5), Use of SASL (Section 6), and
761 Resource Binding (Section 7) as defined herein, and for Session
762 Establishment as defined in [XMPP-IM]; however, the stream features
763 functionality could be used to advertise other negotiable features in
764 the future. If an entity does not understand or support some
765 features, it SHOULD silently ignore them.
769 The root stream element MAY contain an <error/> child element that is
770 prefixed by the streams namespace prefix. The error child MUST be
771 sent by a compliant entity (usually a server rather than a client) if
772 it perceives that a stream-level error has occurred.
776 The following rules apply to stream-level errors:
778 o It is assumed that all stream-level errors are unrecoverable;
779 therefore, if an error occurs at the level of the stream, the
783 Saint-Andre (ed.) Expires September 17, 2004 [Page 14]
785 Internet-Draft XMPP Core March 2004
788 entity that detects the error MUST send a stream error to the
789 other entity, send a closing </stream> tag, and terminate the
790 underlying TCP connection.
792 o If the error occurs while the stream is being set up, the
793 receiving entity MUST still send the opening <stream> tag, include
794 the <error/> element as a child of the stream element, send the
795 closing </stream> tag, and terminate the underlying TCP
796 connection. In this case, if the initiating entity provides an
797 unknown host in the 'to' attribute (or provides no 'to' attribute
798 at all), the server SHOULD provide the server's authoritative
799 hostname in the 'from' attribute of the stream header sent before
805 The syntax for stream errors is as follows:
808 <defined-condition xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
809 <text xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
810 OPTIONAL descriptive text
812 [OPTIONAL application-specific condition element]
815 The <error/> element:
817 o MUST contain a child element corresponding to one of the defined
818 stanza error conditions defined below; this element MUST be
819 qualified by the 'urn:ietf:params:xml:ns:xmpp-streams' namespace
821 o MAY contain a <text/> child containing XML character data that
822 describes the error in more detail; this element MUST be qualified
823 by the 'urn:ietf:params:xml:ns:xmpp-streams' namespace and SHOULD
824 possess an 'xml:lang' attribute specifying the natural language of
825 the XML character data
827 o MAY contain a child element for an application-specific error
828 condition; this element MUST be qualified by an
829 application-defined namespace, and its structure is defined by
832 The <text/> element is OPTIONAL. If included, it SHOULD be used only
833 to provide descriptive or diagnostic information that supplements the
834 meaning of a defined condition or application-specific condition. It
835 SHOULD NOT be interpreted programmatically by an application. It
839 Saint-Andre (ed.) Expires September 17, 2004 [Page 15]
841 Internet-Draft XMPP Core March 2004
844 SHOULD NOT be used as the error message presented to a user, but MAY
845 be shown in addition to the error message associated with the
846 included condition element (or elements).
848 4.7.3 Defined Conditions
850 The following stream-level error conditions are defined:
852 o <bad-format/> -- the entity has sent XML that cannot be processed;
853 this error MAY be used rather than more specific XML-related
854 errors such as <bad-namespace-prefix/>, <invalid-xml/>,
855 <restricted-xml/>, <unsupported-encoding/>, and
856 <xml-not-well-formed/>, although the more specific errors are
859 o <bad-namespace-prefix/> -- the entity has sent a namespace prefix
860 that is unsupported, or has sent no namespace prefix on an element
861 that requires such a prefix (see XML Namespace Names and Prefixes
864 o <conflict/> -- the server is closing the active stream for this
865 entity because a new stream has been initiated that conflicts with
868 o <connection-timeout/> -- the entity has not generated any traffic
869 over the stream for some period of time (configurable according to
870 a local service policy).
872 o <host-gone/> -- the value of the 'to' attribute provided by the
873 initiating entity in the stream header corresponds to a hostname
874 that is no longer hosted by the server.
876 o <host-unknown/> -- the value of the 'to' attribute provided by the
877 initiating entity in the stream header does not correspond to a
878 hostname that is hosted by the server.
880 o <improper-addressing/> -- a stanza sent between two servers lacks
881 a 'to' or 'from' attribute (or the attribute has no value).
883 o <internal-server-error/> -- the server has experienced a
884 misconfiguration or an otherwise-undefined internal error that
885 prevents it from servicing the stream.
887 o <invalid-from/> -- the JID or hostname provided in a 'from'
888 address does not match an authorized JID or validated domain
889 negotiated between servers via SASL or dialback, or between a
890 client and a server via authentication and resource binding.
895 Saint-Andre (ed.) Expires September 17, 2004 [Page 16]
897 Internet-Draft XMPP Core March 2004
900 o <invalid-id/> -- the stream ID or dialback ID is invalid or does
901 not match an ID previously provided.
903 o <invalid-namespace/> -- the streams namespace name is something
904 other than "http://etherx.jabber.org/streams" or the dialback
905 namespace name is something other than "jabber:server:dialback"
906 (see XML Namespace Names and Prefixes (Section 11.2)).
908 o <invalid-xml/> -- the entity has sent invalid XML over the stream
909 to a server that performs validation (see Validation (Section
912 o <not-authorized/> -- the entity has attempted to send data before
913 the stream has been authenticated, or otherwise is not authorized
914 to perform an action related to stream negotiation; the receiving
915 entity MUST NOT process the offending stanza before sending the
918 o <policy-violation/> -- the entity has violated some local service
919 policy; the server MAY choose to specify the policy in the <text/>
920 element or an application-specific condition element.
922 o <remote-connection-failed/> -- the server is unable to properly
923 connect to a remote entity that is required for authentication or
926 o <resource-constraint/> -- the server lacks the system resources
927 necessary to service the stream.
929 o <restricted-xml/> -- the entity has attempted to send restricted
930 XML features such as a comment, processing instruction, DTD,
931 entity reference, or unescaped character (see Restrictions
934 o <see-other-host/> -- the server will not provide service to the
935 initiating entity but is redirecting traffic to another host; the
936 server SHOULD specify the alternate hostname or IP address (which
937 MUST be a valid domain identifier) as the XML character data of
938 the <see-other-host/> element.
940 o <system-shutdown/> -- the server is being shut down and all active
941 streams are being closed.
943 o <undefined-condition/> -- the error condition is not one of those
944 defined by the other conditions in this list; this error condition
945 SHOULD be used only in conjunction with an application-specific
951 Saint-Andre (ed.) Expires September 17, 2004 [Page 17]
953 Internet-Draft XMPP Core March 2004
956 o <unsupported-encoding/> -- the initiating entity has encoded the
957 stream in an encoding that is not supported by the server (see
958 Character Encoding (Section 11.5)).
960 o <unsupported-stanza-type/> -- the initiating entity has sent a
961 first-level child of the stream that is not supported by the
964 o <unsupported-version/> -- the value of the 'version' attribute
965 provided by the initiating entity in the stream header specifies a
966 version of XMPP that is not supported by the server; the server
967 MAY specify the version(s) it supports in the <text/> element.
969 o <xml-not-well-formed/> -- the initiating entity has sent XML that
970 is not well-formed as defined by [XML].
973 4.7.4 Application-Specific Conditions
975 As noted, an application MAY provide application-specific stream
976 error information by including a properly-namespaced child in the
977 error element. The application-specific element SHOULD supplement or
978 further qualify a defined element. Thus the <error/> element will
979 contain two or three child elements:
983 xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
984 <text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
985 Some special application diagnostic information!
987 <escape-your-data xmlns='application-ns'/>
992 4.8 Simplified Stream Examples
994 This section contains two simplified examples of a stream-based
995 "session" of a client on a server (where the "C" lines are sent from
996 the client to the server, and the "S" lines are sent from the server
997 to the client); these examples are included for the purpose of
998 illustrating the concepts introduced thus far.
1002 C: <?xml version='1.0'?>
1007 Saint-Andre (ed.) Expires September 17, 2004 [Page 18]
1009 Internet-Draft XMPP Core March 2004
1013 xmlns='jabber:client'
1014 xmlns:stream='http://etherx.jabber.org/streams'
1016 S: <?xml version='1.0'?>
1020 xmlns='jabber:client'
1021 xmlns:stream='http://etherx.jabber.org/streams'
1023 ... encryption, authentication, and resource binding ...
1024 C: <message from='juliet@example.com'
1025 to='romeo@example.net'
1027 C: <body>Art thou not Romeo, and a Montague?</body>
1029 S: <message from='romeo@example.net'
1030 to='juliet@example.com'
1032 S: <body>Neither, fair saint, if either thee dislike.</body>
1037 A "session" gone bad:
1039 C: <?xml version='1.0'?>
1042 xmlns='jabber:client'
1043 xmlns:stream='http://etherx.jabber.org/streams'
1045 S: <?xml version='1.0'?>
1049 xmlns='jabber:client'
1050 xmlns:stream='http://etherx.jabber.org/streams'
1052 ... encryption, authentication, and resource binding ...
1053 C: <message xml:lang='en'>
1054 <body>Bad XML, no closing body tag!
1057 <xml-not-well-formed
1058 xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
1063 Saint-Andre (ed.) Expires September 17, 2004 [Page 19]
1065 Internet-Draft XMPP Core March 2004
1075 XMPP includes a method for securing the stream from tampering and
1076 eavesdropping. This channel encryption method makes use of the
1077 Transport Layer Security (TLS) protocol [TLS], along with a
1078 "STARTTLS" extension that is modelled after similar extensions for
1079 the IMAP [IMAP], POP3 [POP3], and ACAP [ACAP] protocols as described
1080 in RFC 2595 [USINGTLS]. The namespace name for the STARTTLS
1081 extension is 'urn:ietf:params:xml:ns:xmpp-tls'.
1083 An administrator of a given domain MAY require the use of TLS for
1084 client-to-server communications, server-to-server communications, or
1085 both. Clients SHOULD use TLS to secure the streams prior to
1086 attempting to complete SASL negotiation (Section 6), and servers
1087 SHOULD use TLS between two domains for the purpose of securing
1088 server-to-server communications.
1090 The following rules apply:
1092 1. An initiating entity that complies with this specification MUST
1093 include the 'version' attribute set to a value of "1.0" in the
1094 initial stream header.
1096 2. If the TLS negotiation occurs between two servers,
1097 communications MUST NOT proceed until the Domain Name System
1098 (DNS) hostnames asserted by the servers have been resolved (see
1099 Server-to-Server Communications (Section 14.4)).
1101 3. When a receiving entity that complies with this specification
1102 receives an initial stream header that includes the 'version'
1103 attribute set to a value of at least "1.0", after sending a
1104 stream header in reply (including the version flag) it MUST
1105 include a <starttls/> element (qualified by the
1106 'urn:ietf:params:xml:ns:xmpp-tls' namespace) along with the list
1107 of other stream features it supports.
1109 4. If the initiating entity chooses to use TLS, TLS negotiation
1110 MUST be completed before proceeding to SASL negotiation; this
1111 order of negotiation is required in order to help safeguard
1112 authentication information sent during SASL negotiation, as well
1113 as to make it possible to base the use of the SASL EXTERNAL
1114 mechanism on a certificate provided during prior TLS
1119 Saint-Andre (ed.) Expires September 17, 2004 [Page 20]
1121 Internet-Draft XMPP Core March 2004
1124 5. During TLS negotiation, an entity MUST NOT send any white space
1125 characters (matching production [3] content of [XML]) within the
1126 root stream element as separators between elements (any white
1127 space characters shown in the TLS examples below are included
1128 for the sake of readability only); this prohibition helps to
1129 ensure proper security layer byte precision.
1131 6. The receiving entity MUST consider the TLS negotiation to have
1132 begun immediately after sending the closing ">" character of the
1133 <proceed/> element. The initiating entity MUST consider the TLS
1134 negotiation to have begun immediately after receiving the
1135 closing ">" character of the <proceed/> element from the
1138 7. The initiating entity MUST validate the certificate presented by
1139 the receiving entity; see Certificate Validation (Section 14.2)
1140 regarding certificate validation procedures.
1142 8. Certificates MUST be checked against the hostname as provided by
1143 the initiating entity (e.g., a user), not the hostname as
1144 resolved via the Domain Name System; e.g., if the user specifies
1145 a hostname of "example.com" but a DNS SRV [SRV] lookup returned
1146 "im.example.com", the certificate MUST be checked as
1147 "example.com". If a JID for any kind of XMPP entity (e.g.,
1148 client or server) is represented in a certificate, it SHOULD be
1149 encoded as a GeneralName entry of type otherName inside the
1150 subjectAltName, along with a type-id whose value is "xmpp" (as
1151 these terms are profiled in [X509]).
1153 9. If the TLS negotiation is successful, the receiving entity MUST
1154 discard any knowledge obtained in an insecure manner from the
1155 initiating entity before TLS takes effect.
1157 10. If the TLS negotiation is successful, the initiating entity MUST
1158 discard any knowledge obtained in an insecure manner from the
1159 receiving entity before TLS takes effect.
1161 11. If the TLS negotiation is successful, the receiving entity MUST
1162 NOT offer the STARTTLS extension to the initiating entity along
1163 with the other stream features that are offered when the stream
1166 12. If the TLS negotiation is successful, the initiating entity MUST
1167 continue with SASL negotiation.
1169 13. If the TLS negotiation results in failure, the receiving entity
1170 MUST terminate both the XML stream and the underlying TCP
1175 Saint-Andre (ed.) Expires September 17, 2004 [Page 21]
1177 Internet-Draft XMPP Core March 2004
1180 14. See Mandatory-to-Implement Technologies (Section 14.7) regarding
1181 mechanisms that MUST be supported.
1186 When an initiating entity secures a stream with a receiving entity
1187 using TLS, the steps involved are as follows:
1189 1. The initiating entity opens a TCP connection and initiates the
1190 stream by sending the opening XML stream header to the receiving
1191 entity, including the 'version' attribute set to a value of at
1194 2. The receiving entity responds by opening a TCP connection and
1195 sending an XML stream header to the initiating entity, including
1196 the 'version' attribute set to a value of at least "1.0".
1198 3. The receiving entity offers the STARTTLS extension to the
1199 initiating entity by including it with the list of other
1200 supported stream features (if TLS is required for interaction
1201 with the receiving entity, it SHOULD signal that fact by
1202 including a <required/> element as a child of the <starttls/>
1205 4. The initiating entity issues the STARTTLS command (i.e., a
1206 <starttls/> element qualified by the
1207 'urn:ietf:params:xml:ns:xmpp-tls' namespace) to instruct the
1208 receiving entity that it wishes to begin a TLS negotiation to
1211 5. The receiving entity MUST reply with either a <proceed/> element
1212 or a <failure/> element qualified by the
1213 'urn:ietf:params:xml:ns:xmpp-tls' namespace. If the failure case
1214 occurs, the receiving entity MUST terminate both the XML stream
1215 and the underlying TCP connection. If the proceed case occurs,
1216 the entities MUST attempt to complete the TLS negotiation over
1217 the TCP connection and MUST NOT send any further XML data until
1218 the TLS negotiation is complete.
1220 6. The initiating entity and receiving entity attempt to complete a
1221 TLS negotiation in accordance with [TLS].
1223 7. If the TLS negotiation is unsuccessful, the receiving entity MUST
1224 terminate the TCP connection. If the TLS negotiation is
1225 successful, the initiating entity MUST initiate a new stream by
1226 sending an opening XML stream header to the receiving entity (it
1227 is not necessary to send a closing </stream> tag first, since the
1231 Saint-Andre (ed.) Expires September 17, 2004 [Page 22]
1233 Internet-Draft XMPP Core March 2004
1236 receiving entity and initiating entity MUST consider the original
1237 stream to be closed upon successful TLS negotiation).
1239 8. Upon receiving the new stream header from the initiating entity,
1240 the receiving entity MUST respond by sending a new XML stream
1241 header to the initiating entity along with the available features
1242 (but not including the STARTTLS feature).
1245 5.3 Client-to-Server Example
1247 The following example shows the data flow for a client securing a
1248 stream using STARTTLS (note: the alternate steps shown below are
1249 provided to illustrate the protocol for failure cases; they are not
1250 exhaustive and would not necessarily be triggered by the data sent in
1253 Step 1: Client initiates stream to server:
1256 xmlns='jabber:client'
1257 xmlns:stream='http://etherx.jabber.org/streams'
1261 Step 2: Server responds by sending a stream tag to client:
1264 xmlns='jabber:client'
1265 xmlns:stream='http://etherx.jabber.org/streams'
1270 Step 3: Server sends the STARTTLS extension to client along with
1271 authentication mechanisms and any other stream features:
1274 <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
1277 <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1278 <mechanism>DIGEST-MD5</mechanism>
1279 <mechanism>PLAIN</mechanism>
1287 Saint-Andre (ed.) Expires September 17, 2004 [Page 23]
1289 Internet-Draft XMPP Core March 2004
1292 Step 4: Client sends the STARTTLS command to server:
1294 <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
1296 Step 5: Server informs client that it is allowed to proceed:
1298 <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
1300 Step 5 (alt): Server informs client that TLS negotiation has failed
1301 and closes both stream and TCP connection:
1303 <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
1306 Step 6: Client and server attempt to complete TLS negotiation over
1307 the existing TCP connection.
1309 Step 7: If TLS negotiation is successful, client initiates a new
1313 xmlns='jabber:client'
1314 xmlns:stream='http://etherx.jabber.org/streams'
1318 Step 7 (alt): If TLS negotiation is unsuccessful, server closes TCP
1321 Step 8: Server responds by sending a stream header to client along
1322 with any available stream features:
1325 xmlns='jabber:client'
1326 xmlns:stream='http://etherx.jabber.org/streams'
1331 <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1332 <mechanism>DIGEST-MD5</mechanism>
1333 <mechanism>PLAIN</mechanism>
1334 <mechanism>EXTERNAL</mechanism>
1338 Step 9: Client continues with SASL negotiation (Section 6).
1343 Saint-Andre (ed.) Expires September 17, 2004 [Page 24]
1345 Internet-Draft XMPP Core March 2004
1348 5.4 Server-to-Server Example
1350 The following example shows the data flow for two servers securing a
1351 stream using STARTTLS (note: the alternate steps shown below are
1352 provided to illustrate the protocol for failure cases; they are not
1353 exhaustive and would not necessarily be triggered by the data sent in
1356 Step 1: Server1 initiates stream to Server2:
1359 xmlns='jabber:server'
1360 xmlns:stream='http://etherx.jabber.org/streams'
1364 Step 2: Server2 responds by sending a stream tag to Server1:
1367 xmlns='jabber:server'
1368 xmlns:stream='http://etherx.jabber.org/streams'
1373 Step 3: Server2 sends the STARTTLS extension to Server1 along with
1374 authentication mechanisms and any other stream features:
1377 <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'>
1380 <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1381 <mechanism>DIGEST-MD5</mechanism>
1382 <mechanism>KERBEROS_V4</mechanism>
1386 Step 4: Server1 sends the STARTTLS command to Server2:
1388 <starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
1390 Step 5: Server2 informs Server1 that it is allowed to proceed:
1392 <proceed xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
1394 Step 5 (alt): Server2 informs Server1 that TLS negotiation has failed
1399 Saint-Andre (ed.) Expires September 17, 2004 [Page 25]
1401 Internet-Draft XMPP Core March 2004
1404 <failure xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>
1407 Step 6: Server1 and Server2 attempt to complete TLS negotiation via
1410 Step 7: If TLS negotiation is successful, Server1 initiates a new
1414 xmlns='jabber:server'
1415 xmlns:stream='http://etherx.jabber.org/streams'
1419 Step 7 (alt): If TLS negotiation is unsuccessful, Server2 closes TCP
1422 Step 8: Server2 responds by sending a stream header to Server1 along
1423 with any available stream features:
1426 xmlns='jabber:server'
1427 xmlns:stream='http://etherx.jabber.org/streams'
1432 <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1433 <mechanism>DIGEST-MD5</mechanism>
1434 <mechanism>KERBEROS_V4</mechanism>
1435 <mechanism>EXTERNAL</mechanism>
1439 Step 9: Server1 continues with SASL negotiation (Section 6).
1445 XMPP includes a method for authenticating a stream by means of an
1446 XMPP-specific profile of the Simple Authentication and Security Layer
1447 (SASL) protocol [SASL]. SASL provides a generalized method for
1448 adding authentication support to connection-based protocols, and XMPP
1449 uses a generic XML namespace profile for SASL that conforms to the
1450 profiling requirements of [SASL].
1455 Saint-Andre (ed.) Expires September 17, 2004 [Page 26]
1457 Internet-Draft XMPP Core March 2004
1460 The following rules apply:
1462 1. If the SASL negotiation occurs between two servers,
1463 communications MUST NOT proceed until the Domain Name System
1464 (DNS) hostnames asserted by the servers have been resolved (see
1465 Server-to-Server Communications (Section 14.4)).
1467 2. If the initiating entity is capable of SASL negotiation, it MUST
1468 include the 'version' attribute set to a value of at least "1.0"
1469 in the initial stream header.
1471 3. If the receiving entity is capable of SASL negotiation, it MUST
1472 advertise one or more authentication mechanisms within a
1473 <mechanisms/> element qualified by the
1474 'urn:ietf:params:xml:ns:xmpp-sasl' namespace in reply to the
1475 opening stream tag received from the initiating entity (if the
1476 opening stream tag included the 'version' attribute set to a
1477 value of at least "1.0").
1479 4. During SASL negotiation, an entity MUST NOT send any white space
1480 characters (matching production [3] content of [XML]) within the
1481 root stream element as separators between elements (any white
1482 space characters shown in the SASL examples below are included
1483 for the sake of readability only); this prohibition helps to
1484 ensure proper security layer byte precision.
1486 5. Any XML character data contained within the XML elements used
1487 during SASL negotiation MUST be encoded using base64, where the
1488 encoding adheres to the definition in Section 3 of RFC 3548
1491 6. If provision of a "simple username" is supported by the selected
1492 SASL mechanism (e.g., this is supported by the DIGEST-MD5 and
1493 CRAM-MD5 mechanisms but not by the EXTERNAL and GSSAPI
1494 mechanisms), during authentication the initiating entity SHOULD
1495 provide as the simple username its sending domain (IP address or
1496 fully qualified domain name as contained in a domain identifier)
1497 in the case of server-to-server communications or its registered
1498 account name (user or node name as contained in an XMPP node
1499 identifer) in the case of client-to-server communications.
1501 7. If the initiating entity wishes to act on behalf of another
1502 entity and the selected SASL mechanism supports transmission of
1503 an authorization identity, the initiating entity MUST provide an
1504 authorization identity during SASL negotiation. If the
1505 initiating entity does not wish to act on behalf of another
1506 entity, it MUST NOT provide an authorization identity. As
1507 specified in [SASL], the initiating entity MUST NOT provide an
1511 Saint-Andre (ed.) Expires September 17, 2004 [Page 27]
1513 Internet-Draft XMPP Core March 2004
1516 authorization identity unless the authorization identity is
1517 different from the default authorization identity derived from
1518 the authentication identity as described in [SASL]. If
1519 provided, the value of the authorization identity MUST be of the
1520 form <domain> (i.e., a domain identifier only) for servers and
1521 of the form <node@domain> (i.e., node identifier and domain
1522 identifier) for clients.
1524 8. Upon successful SASL negotiation that involves negotiation of a
1525 security layer, the receiving entity MUST discard any knowledge
1526 obtained from the initiating entity which was obtained in an
1527 insecure manner before the SASL negotiation.
1529 9. Upon successful SASL negotiation that involves negotiation of a
1530 security layer, the initiating entity MUST discard any knowledge
1531 obtained from the receiving entity which was not obtained from
1532 the SASL negotiation itself.
1534 10. See Mandatory-to-Implement Technologies (Section 14.7) regarding
1535 mechanisms that MUST be supported.
1540 When an initiating entity authenticates with a receiving entity using
1541 SASL, the steps involved are as follows:
1543 1. The initiating entity requests SASL authentication by including
1544 the 'version' attribute in the opening XML stream header sent to
1545 the receiving entity, with the value set to "1.0".
1547 2. After sending an XML stream header in reply, the receiving entity
1548 advertises a list of available SASL authentication mechanisms;
1549 each of these is a <mechanism/> element included as a child
1550 within a <mechanisms/> container element qualified by the
1551 'urn:ietf:params:xml:ns:xmpp-sasl' namespace, which in turn is a
1552 child of a <features/> element in the streams namespace. If Use
1553 of TLS (Section 5) needs to be established before a particular
1554 authentication mechanism may be used, the receiving entity MUST
1555 NOT provide that mechanism in the list of available SASL
1556 authentication mechanisms prior to TLS negotiation. If the
1557 initiating entity presents a valid certificate during prior TLS
1558 negotiation, the receiving entity SHOULD offer the SASL EXTERNAL
1559 mechanism to the initiating entity during SASL negotiation (refer
1560 to [SASL]), although the EXTERNAL mechanism MAY be offered under
1561 other circumstances as well.
1563 3. The initiating entity selects a mechanism by sending an <auth/>
1567 Saint-Andre (ed.) Expires September 17, 2004 [Page 28]
1569 Internet-Draft XMPP Core March 2004
1572 element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl'
1573 namespace to the receiving entity and including an appropriate
1574 value for the 'mechanism' attribute. This element MAY contain
1575 XML character data (in SASL terminology, the "initial response")
1576 if the mechanism supports or requires it; if the initiating
1577 entity needs to send a zero-length initial response, it MUST
1578 transmit the response as a single equals sign ("="), which
1579 indicates that the response is present but contains no data.
1581 4. If necessary, the receiving entity challenges the initiating
1582 entity by sending a <challenge/> element qualified by the
1583 'urn:ietf:params:xml:ns:xmpp-sasl' namespace to the initiating
1584 entity; this element MAY contain XML character data (which MUST
1585 be computed in accordance with the definition of the SASL
1586 mechanism chosen by the initiating entity).
1588 5. The initiating entity responds to the challenge by sending a
1589 <response/> element qualified by the
1590 'urn:ietf:params:xml:ns:xmpp-sasl' namespace to the receiving
1591 entity; this element MAY contain XML character data (which MUST
1592 be computed in accordance with the definition of the SASL
1593 mechanism chosen by the initiating entity).
1595 6. If necessary, the receiving entity sends more challenges and the
1596 initiating entity sends more responses.
1598 This series of challenge/response pairs continues until one of three
1601 1. The initiating entity aborts the handshake by sending an <abort/>
1602 element qualified by the 'urn:ietf:params:xml:ns:xmpp-sasl'
1603 namespace to the receiving entity. Upon receiving an <abort/>
1604 element, the receiving entity SHOULD allow a configurable but
1605 reasonable number of retries (at least 2), after which it MUST
1606 terminate the TCP connection; this enables the initiating entity
1607 (e.g., an end-user client) to tolerate incorrectly-provided
1608 credentials (e.g., a mistyped password) without being forced to
1611 2. The receiving entity reports failure of the handshake by sending
1612 a <failure/> element qualified by the
1613 'urn:ietf:params:xml:ns:xmpp-sasl' namespace to the initiating
1614 entity (the particular cause of failure SHOULD be communicated in
1615 an appropriate child element of the <failure/> element as defined
1616 under SASL Errors (Section 6.4)). If the failure case occurs,
1617 the receiving entity SHOULD allow a configurable but reasonable
1618 number of retries (at least 2), after which it MUST terminate the
1619 TCP connection; this enables the initiating entity (e.g., an
1623 Saint-Andre (ed.) Expires September 17, 2004 [Page 29]
1625 Internet-Draft XMPP Core March 2004
1628 end-user client) to tolerate incorrectly-provided credentials
1629 (e.g., a mistyped password) without being forced to reconnect.
1631 3. The receiving entity reports success of the handshake by sending
1632 a <success/> element qualified by the
1633 'urn:ietf:params:xml:ns:xmpp-sasl' namespace to the initiating
1634 entity; this element MAY contain XML character data (in SASL
1635 terminology, "additional data with success") if required by the
1636 chosen SASL mechanism. Upon receiving the <success/> element,
1637 the initiating entity MUST initiate a new stream by sending an
1638 opening XML stream header to the receiving entity (it is not
1639 necessary to send a closing </stream> tag first, since the
1640 receiving entity and initiating entity MUST consider the original
1641 stream to be closed upon sending or receiving the <success/>
1642 element). Upon receiving the new stream header from the
1643 initiating entity, the receiving entity MUST respond by sending a
1644 new XML stream header to the initiating entity, along with any
1645 available features (but NOT including the STARTTLS feature) or an
1646 empty <features/> element (to signify that no additional features
1647 are available); any such additional features not defined herein
1648 MUST be defined by the relevant extension to XMPP.
1653 The profiling requirements of [SASL] require that the following
1654 information be supplied by a protocol definition:
1656 service name: "xmpp"
1658 initiation sequence: After the initiating entity provides an opening
1659 XML stream header and the receiving entity replies in kind, the
1660 receiving entity provides a list of acceptable authentication
1661 methods. The initiating entity chooses one method from the list
1662 and sends it to the receiving entity as the value of the
1663 'mechanism' attribute possessed by an <auth/> element, optionally
1664 including an initial response to avoid a round trip.
1666 exchange sequence: Challenges and responses are carried through the
1667 exchange of <challenge/> elements from receiving entity to
1668 initiating entity and <response/> elements from initiating entity
1669 to receiving entity. The receiving entity reports failure by
1670 sending a <failure/> element and success by sending a <success/>
1671 element; the initiating entity aborts the exchange by sending an
1672 <abort/> element. Upon successful negotiation, both sides
1673 consider the original XML stream to be closed and new stream
1674 headers are sent by both entities.
1679 Saint-Andre (ed.) Expires September 17, 2004 [Page 30]
1681 Internet-Draft XMPP Core March 2004
1684 security layer negotiation: The security layer takes effect
1685 immediately after sending the closing ">" character of the
1686 <success/> element for the receiving entity, and immediately after
1687 receiving the closing ">" character of the <success/> element for
1688 the initiating entity. The order of layers is first [TCP], then
1689 [TLS], then [SASL], then XMPP.
1691 use of the authorization identity: The authorization identity may be
1692 used by xmpp to denote the non-default <node@domain> of a client
1693 or the sending <domain> of a server.
1698 The following SASL-related error conditions are defined:
1700 o <aborted/> -- The receiving entity acknowledges an <abort/>
1701 element sent by the initiating entity; sent in reply to the
1704 o <incorrect-encoding/> -- The data provided by the initiating
1705 entity could not be processed because the [BASE64] encoding is
1706 incorrect (e.g., because the encoding does not adhere to the
1707 definition in Section 3 of [BASE64]); sent in reply to a
1708 <response/> element or an <auth/> element with initial response
1711 o <invalid-authzid/> -- The authzid provided by the initiating
1712 entity is invalid, either because it is incorrectly formatted or
1713 because the initiating entity does not have permissions to
1714 authorize that ID; sent in reply to a <response/> element or an
1715 <auth/> element with initial response data.
1717 o <invalid-mechanism/> -- The initiating entity did not provide a
1718 mechanism or requested a mechanism that is not supported by the
1719 receiving entity; sent in reply to an <auth/> element.
1721 o <mechanism-too-weak/> -- The mechanism requested by the initiating
1722 entity is weaker than server policy permits for that initiating
1723 entity; sent in reply to a <response/> element or an <auth/>
1724 element with initial response data.
1726 o <not-authorized/> -- The authentication failed because the
1727 initiating entity did not provide valid credentials (this includes
1728 but is not limited to the case of an unknown username); sent in
1729 reply to a <response/> element or an <auth/> element with initial
1735 Saint-Andre (ed.) Expires September 17, 2004 [Page 31]
1737 Internet-Draft XMPP Core March 2004
1740 o <temporary-auth-failure/> -- The authentication failed because of
1741 a temporary error condition within the receiving entity; sent in
1742 reply to an <auth/> element or <response/> element.
1745 6.5 Client-to-Server Example
1747 The following example shows the data flow for a client authenticating
1748 with a server using SASL, normally after successful TLS negotiation
1749 (note: the alternate steps shown below are provided to illustrate the
1750 protocol for failure cases; they are not exhaustive and would not
1751 necessarily be triggered by the data sent in the example).
1753 Step 1: Client initiates stream to server:
1756 xmlns='jabber:client'
1757 xmlns:stream='http://etherx.jabber.org/streams'
1761 Step 2: Server responds with a stream tag sent to client:
1764 xmlns='jabber:client'
1765 xmlns:stream='http://etherx.jabber.org/streams'
1770 Step 3: Server informs client of available authentication mechanisms:
1773 <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1774 <mechanism>DIGEST-MD5</mechanism>
1775 <mechanism>PLAIN</mechanism>
1779 Step 4: Client selects an authentication mechanism:
1781 <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
1782 mechanism='DIGEST-MD5'/>
1784 Step 5: Server sends a [BASE64] encoded challenge to client:
1786 <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1787 cmVhbG09InNvbWVyZWFsbSIsbm9uY2U9Ik9BNk1HOXRFUUdtMmhoIixxb3A9ImF1dGgi
1791 Saint-Andre (ed.) Expires September 17, 2004 [Page 32]
1793 Internet-Draft XMPP Core March 2004
1796 LGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNzCg==
1799 The decoded challenge is:
1801 realm="somerealm",nonce="OA6MG9tEQGm2hh",\
1802 qop="auth",charset=utf-8,algorithm=md5-sess
1804 Step 5 (alt): Server returns error to client:
1806 <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1807 <incorrect-encoding/>
1811 Step 6: Client sends a [BASE64] encoded response to the challenge:
1813 <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1814 dXNlcm5hbWU9InNvbWVub2RlIixyZWFsbT0ic29tZXJlYWxtIixub25jZT0i
1815 T0E2TUc5dEVRR20yaGgiLGNub25jZT0iT0E2TUhYaDZWcVRyUmsiLG5jPTAw
1816 MDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvZXhhbXBsZS5jb20i
1817 LHJlc3BvbnNlPWQzODhkYWQ5MGQ0YmJkNzYwYTE1MjMyMWYyMTQzYWY3LGNo
1821 The decoded response is:
1823 username="somenode",realm="somerealm",\
1824 nonce="OA6MG9tEQGm2hh",cnonce="OA6MHXh6VqTrRk",\
1825 nc=00000001,qop=auth,digest-uri="xmpp/example.com",\
1826 response=d388dad90d4bbd760a152321f2143af7,charset=utf-8
1828 Step 7: Server sends another [BASE64] encoded challenge to client:
1830 <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1831 cnNwYXV0aD1lYTQwZjYwMzM1YzQyN2I1NTI3Yjg0ZGJhYmNkZmZmZAo=
1834 The decoded challenge is:
1836 rspauth=ea40f60335c427b5527b84dbabcdfffd
1838 Step 7 (alt): Server returns error to client:
1840 <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1841 <temporary-auth-failure/>
1847 Saint-Andre (ed.) Expires September 17, 2004 [Page 33]
1849 Internet-Draft XMPP Core March 2004
1852 Step 8: Client responds to the challenge:
1854 <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
1856 Step 9: Server informs client of successful authentication:
1858 <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
1860 Step 9 (alt): Server informs client of failed authentication:
1862 <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1863 <temporary-auth-failure/>
1867 Step 10: Client initiates a new stream to server:
1870 xmlns='jabber:client'
1871 xmlns:stream='http://etherx.jabber.org/streams'
1875 Step 11: Server responds by sending a stream header to client along
1876 with any additional features (or an empty features element):
1879 xmlns='jabber:client'
1880 xmlns:stream='http://etherx.jabber.org/streams'
1885 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
1886 <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
1890 6.6 Server-to-Server Example
1892 The following example shows the data flow for a server authenticating
1893 with another server using SASL, normally after successful TLS
1894 negotiation (note: the alternate steps shown below are provided to
1895 illustrate the protocol for failure cases; they are not exhaustive
1896 and would not necessarily be triggered by the data sent in the
1899 Step 1: Server1 initiates stream to Server2:
1903 Saint-Andre (ed.) Expires September 17, 2004 [Page 34]
1905 Internet-Draft XMPP Core March 2004
1909 xmlns='jabber:server'
1910 xmlns:stream='http://etherx.jabber.org/streams'
1914 Step 2: Server2 responds with a stream tag sent to Server1:
1917 xmlns='jabber:server'
1918 xmlns:stream='http://etherx.jabber.org/streams'
1923 Step 3: Server2 informs Server1 of available authentication
1927 <mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1928 <mechanism>DIGEST-MD5</mechanism>
1929 <mechanism>KERBEROS_V4</mechanism>
1933 Step 4: Server1 selects an authentication mechanism:
1935 <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
1936 mechanism='DIGEST-MD5'/>
1938 Step 5: Server2 sends a [BASE64] encoded challenge to Server1:
1940 <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1941 dXNlcm5hbWU9ImV4YW1wbGUuY29tIixyZWFsbT0ic29tZXJlYWxtIixub25j
1942 ZT0iT0E2TUc5dEVRR20yaGgiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxh
1943 bGdvcml0aG09bWQ1LXNlc3MK
1946 The decoded challenge is:
1948 username="example.com",realm="somerealm",\
1949 nonce="OA6MG9tEQGm2hh",qop="auth",\
1950 charset=utf-8,algorithm=md5-sess
1952 Step 5 (alt): Server2 returns error to Server1:
1954 <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1955 <incorrect-encoding/>
1959 Saint-Andre (ed.) Expires September 17, 2004 [Page 35]
1961 Internet-Draft XMPP Core March 2004
1967 Step 6: Server1 sends a [BASE64] encoded response to the challenge:
1969 <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1970 dXNlcm5hbWU9ImV4YW1wbGUuY29tIixyZWFsbT0ic29tZXJlYWxtIixub25j
1971 ZT0iT0E2TUc5dEVRR20yaGgiLGNub25jZT0iT0E2TUhYaDZWcVRyUmsiLG5j
1972 PTAwMDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvZXhhbXBsZS5j
1973 b20iLHJlc3BvbnNlPWQzODhkYWQ5MGQ0YmJkNzYwYTE1MjMyMWYyMTQzYWY3
1974 LGNoYXJzZXQ9dXRmLTgK
1977 The decoded response is:
1979 username="example.com",realm="somerealm",\
1980 nonce="OA6MG9tEQGm2hh",cnonce="OA6MHXh6VqTrRk",\
1981 nc=00000001,qop=auth,digest-uri="xmpp/example.com",\
1982 response=d388dad90d4bbd760a152321f2143af7,charset=utf-8
1984 Step 7: Server2 sends another [BASE64] encoded challenge to Server1:
1986 <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
1987 cnNwYXV0aD1lYTQwZjYwMzM1YzQyN2I1NTI3Yjg0ZGJhYmNkZmZmZAo=
1990 The decoded challenge is:
1992 rspauth=ea40f60335c427b5527b84dbabcdfffd
1994 Step 7 (alt): Server2 returns error to Server1:
1996 <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
2001 Step 8: Server1 responds to the challenge:
2003 <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
2005 Step 8 (alt): Server1 aborts negotiation:
2007 <abort xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
2009 Step 9: Server2 informs Server1 of successful authentication:
2011 <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
2015 Saint-Andre (ed.) Expires September 17, 2004 [Page 36]
2017 Internet-Draft XMPP Core March 2004
2020 Step 9 (alt): Server2 informs Server1 of failed authentication:
2022 <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
2027 Step 10: Server1 initiates a new stream to Server2:
2030 xmlns='jabber:server'
2031 xmlns:stream='http://etherx.jabber.org/streams'
2035 Step 11: Server2 responds by sending a stream header to Server1 along
2036 with any additional features (or an empty features element):
2039 xmlns='jabber:client'
2040 xmlns:stream='http://etherx.jabber.org/streams'
2049 After SASL negotiation (Section 6) with the receiving entity, the
2050 initiating entity MAY want or need to bind a specific resource to
2051 that stream. In general this applies only to clients: in order to
2052 conform to the addressing format (Section 3) and stanza delivery
2053 rules (Section 10) specified herein, there MUST be a resource
2054 identifier associated with the <node@domain> of the client (which is
2055 either generated by the server or provided by the client
2056 application); this ensures that the address for use over that stream
2057 is a "full JID" of the form <node@domain/resource>.
2059 Upon receiving a success indication within the SASL negotiation, the
2060 client MUST send a new stream header to the server, to which the
2061 server MUST respond with a stream header as well as a list of
2062 available stream features. Specifically, if the server requires the
2063 client to bind a resource to the stream after successful SASL
2064 negotiation, it MUST include an empty <bind/> element qualified by
2065 the 'urn:ietf:params:xml:ns:xmpp-bind' namespace in the stream
2066 features list it presents to the client upon sending the header for
2067 the response stream sent after successful SASL negotiation (but not
2071 Saint-Andre (ed.) Expires September 17, 2004 [Page 37]
2073 Internet-Draft XMPP Core March 2004
2078 Server advertises resource binding feature to client:
2081 xmlns='jabber:client'
2082 xmlns:stream='http://etherx.jabber.org/streams'
2087 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
2090 Upon being so informed that resource binding is required, the client
2091 MUST bind a resource to the stream by sending to the server an IQ
2092 stanza of type "set" (see IQ Semantics (Section 9.2.3)) containing
2093 data qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace.
2095 If the client wishes to allow the server to generate the resource
2096 identifier on its behalf, it sends an IQ stanza of type "set" that
2097 contains an empty <bind/> element:
2099 Client asks server to bind a resource:
2101 <iq type='set' id='bind_1'>
2102 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
2105 A server that supports resource binding MUST be able to generate a
2106 resource identifier on behalf of a client. A resource identifier
2107 generated by the server MUST be unique for that <node@domain>.
2109 If the client wishes to specify the resource identifier, it sends an
2110 IQ stanza of type "set" that contains the desired resource identifier
2111 as the XML character data of a <resource/> element that is a child of
2112 the <bind/> element:
2114 Client binds a resource:
2116 <iq type='set' id='bind_2'>
2117 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
2118 <resource>someresource</resource>
2122 Once the server has generated a resource identifier for the client or
2123 accepted the resource identifier provided by the client, it MUST
2127 Saint-Andre (ed.) Expires September 17, 2004 [Page 38]
2129 Internet-Draft XMPP Core March 2004
2132 return an IQ stanza of type "result" to the client, which MUST
2133 include a <jid/> child element that specifies the full JID for the
2134 connected resource as determined by the server:
2136 Server informs client of successful resource binding:
2138 <iq type='result' id='bind_2'>
2139 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
2140 <jid>somenode@example.com/someresource</jid>
2144 A server SHOULD accept the resource identifier provided by the
2145 client, but MAY override it with a resource identifier that the
2146 server generates; in this case, the server SHOULD NOT return a stanza
2147 error (e.g., <forbidden/>) to the client but instead SHOULD
2148 communicate the generated resource identifier to the client in the IQ
2149 result as shown above.
2151 When a client supplies a resource identifier, the following stanza
2152 error conditions are possible (see Stanza Errors (Section 9.3)):
2154 o The provided resource identifier cannot be processed by the server
2155 in accordance with Resourceprep (Appendix B).
2157 o The client is not allowed to bind a resource to the stream (e.g.,
2158 because the node or user has reached a limit on the number of
2159 connected resources allowed).
2161 o The provided resource identifier is already in use but the server
2162 does not allow binding of multiple connected resources with the
2165 The protocol for these error conditions is shown below.
2167 Resource identifier cannot be processed:
2169 <iq type='error' id='bind_2'>
2170 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
2171 <resource>someresource</resource>
2173 <error type='modify'>
2174 <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
2178 Client is not allowed to bind a resource:
2183 Saint-Andre (ed.) Expires September 17, 2004 [Page 39]
2185 Internet-Draft XMPP Core March 2004
2188 <iq type='error' id='bind_2'>
2189 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
2190 <resource>someresource</resource>
2192 <error type='cancel'>
2193 <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
2197 Resource identifier is in use:
2199 <iq type='error' id='bind_2'>
2200 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
2201 <resource>someresource</resource>
2203 <error type='cancel'>
2204 <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
2208 If, before completing the resource binding step, the client attempts
2209 to send an XML stanza other than an IQ stanza with a <bind/> child
2210 qualified by the 'urn:ietf:params:xml:ns:xmpp-bind' namespace, the
2211 server MUST NOT process the stanza and SHOULD return a
2212 <not-authorized/> stanza error to the client.
2218 The Jabber protocols from which XMPP was adapted include a "server
2219 dialback" method for protecting against domain spoofing, thus making
2220 it more difficult to spoof XML stanzas. Server dialback is not a
2221 security mechanism, and results in weak verification of server
2222 identities only (see Server-to-Server Communications (Section 14.4)
2223 regarding this method's security characteristics). Domains requiring
2224 robust security SHOULD use TLS and SASL; see Server-to-Server
2225 Communications (Section 14.4) for details. If SASL is used for
2226 server-to-server authentication, dialback SHOULD NOT be used since it
2227 is unnecessary. Documentation of dialback is included mainly for the
2228 sake of backward-compatibility with existing implementations and
2231 The server dialback method is made possible by the existence of the
2232 Domain Name System (DNS), since one server can (normally) discover
2233 the authoritative server for a given domain. Because dialback
2234 depends on DNS, inter-domain communications MUST NOT proceed until
2235 the Domain Name System (DNS) hostnames asserted by the servers have
2239 Saint-Andre (ed.) Expires September 17, 2004 [Page 40]
2241 Internet-Draft XMPP Core March 2004
2244 been resolved (see Server-to-Server Communications (Section 14.4)).
2246 Server dialback is uni-directional, and results in (weak)
2247 verification of identities for one stream in one direction. Because
2248 server dialback is not an authentication mechanism, mutual
2249 authentication is not possible via dialback. Therefore server
2250 dialback MUST be completed in each direction in order to enable
2251 bi-directional communications between two domains.
2253 The method for generating and verifying the keys used in server
2254 dialback MUST take into account the hostnames being used, the stream
2255 ID generated by the receiving server, and a secret known by the
2256 authoritative server's network. The stream ID is security-critical
2257 in server dialback and therefore MUST be both unpredictable and
2258 non-repeating (see [RANDOM] for recommendations regarding randomness
2259 for security purposes).
2261 Any error that occurs during dialback negotiation MUST be considered
2262 a stream error, resulting in termination of the stream and of the
2263 underlying TCP connection. The possible error conditions are
2264 specified in the protocol description below.
2266 The following terminology applies:
2268 o Originating Server -- the server that is attempting to establish a
2269 connection between two domains.
2271 o Receiving Server -- the server that is trying to authenticate that
2272 Originating Server represents the domain which it claims to be.
2274 o Authoritative Server -- the server that answers to the DNS
2275 hostname asserted by Originating Server; for basic environments
2276 this will be Originating Server, but it could be a separate
2277 machine in Originating Server's network.
2282 The following is a brief summary of the order of events in dialback:
2284 1. Originating Server establishes a connection to Receiving Server.
2286 2. Originating Server sends a 'key' value over the connection to
2289 3. Receiving Server establishes a connection to Authoritative
2295 Saint-Andre (ed.) Expires September 17, 2004 [Page 41]
2297 Internet-Draft XMPP Core March 2004
2300 4. Receiving Server sends the same 'key' value to Authoritative
2303 5. Authoritative Server replies that key is valid or invalid.
2305 6. Receiving Server informs Originating Server whether it is
2306 authenticated or not.
2308 We can represent this flow of events graphically as follows:
2310 Originating Receiving
2312 ----------- ---------
2314 | establish connection |
2315 | ----------------------> |
2317 | send stream header |
2318 | ----------------------> |
2320 | send stream header |
2321 | <---------------------- |
2323 | send dialback key | Server
2324 | ----------------------> | -------------
2326 | establish connection |
2327 | ----------------------> |
2329 | send stream header |
2330 | ----------------------> |
2332 | send stream header |
2333 | <---------------------- |
2335 | send verify request |
2336 | ----------------------> |
2338 | send verify response |
2339 | <---------------------- |
2341 | report dialback result |
2342 | <---------------------- |
2351 Saint-Andre (ed.) Expires September 17, 2004 [Page 42]
2353 Internet-Draft XMPP Core March 2004
2358 The detailed protocol interaction between the servers is as follows:
2360 1. Originating Server establishes TCP connection to Receiving
2363 2. Originating Server sends a stream header to Receiving Server:
2366 xmlns:stream='http://etherx.jabber.org/streams'
2367 xmlns='jabber:server'
2368 xmlns:db='jabber:server:dialback'>
2370 Note: The 'to' and 'from' attributes are OPTIONAL on the root
2371 stream element. The inclusion of the xmlns:db namespace
2372 declaration with the name shown indicates to Receiving Server
2373 that Originating Server supports dialback. If the namespace
2374 name is incorrect, then Receiving Server MUST generate an
2375 <invalid-namespace/> stream error condition and terminate both
2376 the XML stream and the underlying TCP connection.
2378 3. Receiving Server SHOULD send a stream header back to Originating
2379 Server, including a unique ID for this interaction:
2382 xmlns:stream='http://etherx.jabber.org/streams'
2383 xmlns='jabber:server'
2384 xmlns:db='jabber:server:dialback'
2387 Note: The 'to' and 'from' attributes are OPTIONAL on the root
2388 stream element. If the namespace name is incorrect, then
2389 Originating Server MUST generate an <invalid-namespace/> stream
2390 error condition and terminate both the XML stream and the
2391 underlying TCP connection. Note well that Receiving Server
2392 SHOULD reply but MAY silently terminate the XML stream and
2393 underlying TCP connection depending on security policies in
2394 place; however, if Receiving Server desires to proceed, it MUST
2395 send a stream header back to Originating Server.
2397 4. Originating Server sends a dialback key to Receiving Server:
2400 to='Receiving Server'
2401 from='Originating Server'>
2407 Saint-Andre (ed.) Expires September 17, 2004 [Page 43]
2409 Internet-Draft XMPP Core March 2004
2412 Note: This key is not examined by Receiving Server, since
2413 Receiving Server does not keep information about Originating
2414 Server between sessions. The key generated by Originating
2415 Server MUST be based in part on the value of the ID provided by
2416 Receiving Server in the previous step, and in part on a secret
2417 shared by Originating Server and Authoritative Server. If the
2418 value of the 'to' address does not match a hostname recognized
2419 by Receiving Server, then Receiving Server MUST generate a
2420 <host-unknown/> stream error condition and terminate both the
2421 XML stream and the underlying TCP connection. If the value of
2422 the 'from' address matches a domain with which Receiving Server
2423 already has an established connection, then Receiving Server
2424 MUST maintain the existing connection until it validates whether
2425 the new connection is legitimate; additionally, Receiving Server
2426 MAY choose to generate a <not-authorized/> stream error
2427 condition for the new connection and then terminate both the XML
2428 stream and the underlying TCP connection related to the new
2431 5. Receiving Server establishes a TCP connection back to the domain
2432 name asserted by Originating Server, as a result of which it
2433 connects to Authoritative Server. (Note: As an optimization, an
2434 implementation MAY reuse an existing connection here.)
2436 6. Receiving Server sends Authoritative Server a stream header:
2439 xmlns:stream='http://etherx.jabber.org/streams'
2440 xmlns='jabber:server'
2441 xmlns:db='jabber:server:dialback'>
2443 Note: The 'to' and 'from' attributes are OPTIONAL on the root
2444 stream element. If the namespace name is incorrect, then
2445 Authoritative Server MUST generate an <invalid-namespace/>
2446 stream error condition and terminate both the XML stream and the
2447 underlying TCP connection.
2449 7. Authoritative Server sends Receiving Server a stream header:
2452 xmlns:stream='http://etherx.jabber.org/streams'
2453 xmlns='jabber:server'
2454 xmlns:db='jabber:server:dialback'
2457 Note: If the namespace name is incorrect, then Receiving Server
2458 MUST generate an <invalid-namespace/> stream error condition and
2459 terminate both the XML stream and the underlying TCP connection
2463 Saint-Andre (ed.) Expires September 17, 2004 [Page 44]
2465 Internet-Draft XMPP Core March 2004
2468 between it and Authoritative Server. If a stream error occurs
2469 between Receiving Server and Authoritative Server, then
2470 Receiving Server MUST generate a <remote-connection-failed/>
2471 stream error condition and terminate both the XML stream and the
2472 underlying TCP connection between it and Originating Server.
2474 8. Receiving Server sends Authoritative Server a request for
2475 verification of a key:
2478 from='Receiving Server'
2479 to='Originating Server'
2484 Note: Passed here are the hostnames, the original identifier
2485 from Receiving Server's stream header to Originating Server in
2486 Step 3, and the key that Originating Server sent to Receiving
2487 Server in Step 4. Based on this information as well as shared
2488 secret information within the Authoritative Server's network,
2489 the key is verified. Any verifiable method MAY be used to
2490 generate the key. If the value of the 'to' address does not
2491 match a hostname recognized by Authoritative Server, then
2492 Authoritative Server MUST generate a <host-unknown/> stream
2493 error condition and terminate both the XML stream and the
2494 underlying TCP connection. If the value of the 'from' address
2495 does not match the hostname represented by Receiving Server when
2496 opening the TCP connection (or any validated domain thereof,
2497 such as a validated subdomain of Receiving Server's hostname or
2498 another validated domain hosted by Receiving Server), then
2499 Authoritative Server MUST generate an <invalid-from/> stream
2500 error condition and terminate both the XML stream and the
2501 underlying TCP connection.
2503 9. Authoritative Server verifies whether the key was valid or
2507 from='Originating Server'
2508 to='Receiving Server'
2510 id='457F9224A0...'/>
2515 from='Originating Server'
2519 Saint-Andre (ed.) Expires September 17, 2004 [Page 45]
2521 Internet-Draft XMPP Core March 2004
2524 to='Receiving Server'
2526 id='457F9224A0...'/>
2528 Note: If the ID does not match that provided by Receiving Server
2529 in Step 3, then Receiving Server MUST generate an <invalid-id/>
2530 stream error condition and terminate both the XML stream and the
2531 underlying TCP connection. If the value of the 'to' address
2532 does not match a hostname recognized by Receiving Server, then
2533 Receiving Server MUST generate a <host-unknown/> stream error
2534 condition and terminate both the XML stream and the underlying
2535 TCP connection. If the value of the 'from' address does not
2536 match the hostname represented by Originating Server when
2537 opening the TCP connection (or any validated domain thereof,
2538 such as a validated subdomain of Originating Server's hostname
2539 or another validated domain hosted by Originating Server), then
2540 Receiving Server MUST generate an <invalid-from/> stream error
2541 condition and terminate both the XML stream and the underlying
2542 TCP connection. After returning the verification to Receiving
2543 Server, Authoritative Server SHOULD terminate the stream between
2546 10. Receiving Server informs Originating Server of the result:
2549 from='Receiving Server'
2550 to='Originating Server'
2553 Note: At this point the connection has either been validated via
2554 a type='valid', or reported as invalid. If the connection is
2555 invalid, then Receiving Server MUST terminate both the XML
2556 stream and the underlying TCP connection. If the connection is
2557 validated, data can be sent by Originating Server and read by
2558 Receiving Server; before that, all XML stanzas sent to Receiving
2559 Server SHOULD be silently dropped.
2561 The result of the foregoing is that Receiving Server has verified the
2562 identity of Originating Server, so that Originating Server can send,
2563 and Receiving Server can accept, XML stanzas over the "initial
2564 stream" (i.e., the stream from Originating Server to Receiving
2565 Server). In order to verify the identities of the entities using the
2566 "response stream" (i.e., the stream from Receiving Server to
2567 Originating Server), dialback MUST be completed in the opposite
2570 After successful dialback negotiation, Receiving Server SHOULD accept
2571 subsequent <db:result/> packets (e.g., validation requests sent to a
2575 Saint-Andre (ed.) Expires September 17, 2004 [Page 46]
2577 Internet-Draft XMPP Core March 2004
2580 subdomain or other hostname serviced by Receiving Server) from the
2581 Originating Server over the existing validated connection; this
2582 enables "piggybacking" of the original validated connection in one
2585 Even if dialback negotiation is successful, a server MUST verify that
2586 all XML stanzas received from the other server include a 'from'
2587 attribute and a 'to' attribute; if a stanza does not meet this
2588 restriction, the server that receives the stanza MUST generate an
2589 <improper-addressing/> stream error condition and terminate both the
2590 XML stream and the underlying TCP connection. Furthermore, a server
2591 MUST verify that the 'from' attribute of stanzas received from the
2592 other server includes a validated domain for the stream; if a stanza
2593 does not meet this restriction, the server that receives the stanza
2594 MUST generate an <invalid-from/> stream error condition and terminate
2595 both the XML stream and the underlying TCP connection. Both of these
2596 checks help to prevent spoofing related to particular stanzas.
2600 After TLS negotiation (Section 5) if desired, SASL negotiation
2601 (Section 6), and Resource Binding (Section 7) if necessary, XML
2602 stanzas can be sent over the streams. Three kinds of XML stanza are
2603 defined for the 'jabber:client' and 'jabber:server' namespaces:
2604 <message/>, <presence/>, and <iq/>. In addition, there are five
2605 common attributes for these kinds of stanza. These common
2606 attributes, as well as the basic semantics of the three stanza kinds,
2607 are defined herein; more detailed information regarding the syntax of
2608 XML stanzas in relation to instant messaging and presence
2609 applications is provided in [XMPP-IM].
2611 9.1 Common Attributes
2613 The following five attributes are common to message, presence, and IQ
2618 The 'to' attribute specifies the JID of the intended recipient for
2621 In the 'jabber:client' namespace, a stanza SHOULD possess a 'to'
2622 attribute, although a stanza sent from a client to a server for
2623 handling by that server (e.g., presence sent to the server for
2624 broadcasting to other entities) SHOULD NOT possess a 'to' attribute.
2626 In the 'jabber:server' namespace, a stanza MUST possess a 'to'
2627 attribute; if a server receives a stanza that does not meet this
2631 Saint-Andre (ed.) Expires September 17, 2004 [Page 47]
2633 Internet-Draft XMPP Core March 2004
2636 restriction, it MUST generate an <improper-addressing/> stream error
2637 condition and terminate both the XML stream and the underlying TCP
2638 connection with the offending server.
2640 If the value of the 'to' attribute is invalid or cannot be contacted,
2641 the entity discovering that fact (usually the sender's or recipient's
2642 server) MUST return an appropriate error to the sender, setting the
2643 'from' attribute of the error stanza to the value provided in the
2644 'to' attribute of the offending stanza.
2648 The 'from' attribute specifies the JID of the sender.
2650 When a server receives an XML stanza within the context of an
2651 authenticated stream qualified by the 'jabber:client' namespace, it
2652 MUST do one of the following:
2654 1. validate that the value of the 'from' attribute provided by the
2655 client is that of a connected resource for the associated entity
2657 2. add a 'from' address to the stanza whose value is the bare JID
2658 (<node@domain>) or the full JID (<node@domain/resource>)
2659 determined by the server for the connected resource that
2660 generated the stanza (see Determination of Addresses (Section
2663 If a client attempts to send an XML stanza for which the value of the
2664 'from' attribute does not match one of the connected resources for
2665 that entity, the server SHOULD return an <invalid-from/> stream error
2666 to the client. If a client attempts to send an XML stanza over a
2667 stream that is not yet authenticated, the server SHOULD return a
2668 <not-authorized/> stream error to the client. If generated, both of
2669 these conditions MUST result in closing of the stream and termination
2670 of the underlying TCP connection; this helps to prevent a denial of
2671 service attack launched from a rogue client.
2673 When a server generates a stanza from the server itself for delivery
2674 to a connected client (e.g., in the context of data storage services
2675 provided by the server on behalf of the client), the stanza MUST
2676 either (1) not include a 'from' attribute or (2) include a 'from'
2677 attribute whose value is the account's bare JID (<node@domain>) or
2678 client's full JID (<node@domain/resource>). A server MUST NOT send
2679 to the client a stanza without a 'from' attribute if the stanza was
2680 not generated by the server itself. When a client receives a stanza
2681 that does not include a 'from' attribute, it MUST assume that the
2682 stanza is from the server to which the client is connected.
2687 Saint-Andre (ed.) Expires September 17, 2004 [Page 48]
2689 Internet-Draft XMPP Core March 2004
2692 In the 'jabber:server' namespace, a stanza MUST possess a 'from'
2693 attribute; if a server receives a stanza that does not meet this
2694 restriction, it MUST generate an <improper-addressing/> stream error
2695 condition. Furthermore, the domain identifier portion of the JID
2696 contained in the 'from' attribute MUST match the hostname of the
2697 sending server (or any validated domain thereof, such as a validated
2698 subdomain of the sending server's hostname or another validated
2699 domain hosted by the sending server) as communicated in the SASL
2700 negotiation or dialback negotiation; if a server receives a stanza
2701 that does not meet this restriction, it MUST generate an
2702 <invalid-from/> stream error condition. Both of these conditions
2703 MUST result in closing of the stream and termination of the
2704 underlying TCP connection; this helps to prevent a denial of service
2705 attack launched from a rogue server.
2709 The optional 'id' attribute MAY be used by a sending entity for
2710 internal tracking of stanzas that it sends and receives (especially
2711 for tracking the request-response interaction inherent in the
2712 semantics of IQ stanzas). It is OPTIONAL for the value of the 'id'
2713 attribute to be unique globally, within a domain, or within a stream.
2714 The semantics of IQ stanzas impose additional restrictions; see IQ
2715 Semantics (Section 9.2.3).
2719 The 'type' attribute specifies detailed information about the purpose
2720 or context of the message, presence, or IQ stanza. The particular
2721 allowable values for the 'type' attribute vary depending on whether
2722 the stanza is a message, presence, or IQ; the values for message and
2723 presence stanzas are specific to instant messaging and presence
2724 applications and therefore are defined in [XMPP-IM], whereas the
2725 values for IQ stanzas specify the role of an IQ stanza in a
2726 structured request-response "conversation" and thus are defined under
2727 IQ Semantics (Section 9.2.3) below. The only 'type' value common to
2728 all three stanzas is "error", for which see Stanza Errors (Section
2733 A stanza SHOULD possess an 'xml:lang' attribute (as defined in
2734 Section 2.12 of [XML]) if the stanza contains XML character data that
2735 is intended to be presented to a human user (as explained in RFC 2277
2736 [CHARSET], "internationalization is for humans"). The value of the
2737 'xml:lang' attribute specifies the default language of any such
2738 human-readable XML character data, which MAY be overridden by the
2739 'xml:lang' attribute of a specific child element. If a stanza does
2743 Saint-Andre (ed.) Expires September 17, 2004 [Page 49]
2745 Internet-Draft XMPP Core March 2004
2748 not possess an 'xml:lang' attribute, an implementation MUST assume
2749 that the default language is that specified for the stream as defined
2750 under Stream Attributes (Section 4.4) above. The value of the
2751 'xml:lang' attribute MUST be an NMTOKEN and MUST conform to the
2752 format defined in RFC 3066 [LANGTAGS].
2756 9.2.1 Message Semantics
2758 The <message/> stanza kind can be seen as a "push" mechanism whereby
2759 one entity pushes information to another entity, similar to the
2760 communications that occur in a system such as email. All message
2761 stanzas SHOULD possess a 'to' attribute that specifies the intended
2762 recipient of the message; upon receiving such a stanza, a server
2763 SHOULD route or deliver it to the intended recipient (see Server
2764 Rules for Handling XML Stanzas (Section 10) for general routing and
2765 delivery rules related to XML stanzas).
2767 9.2.2 Presence Semantics
2769 The <presence/> element can be seen as a basic broadcast or
2770 "publish-subscribe" mechanism, whereby multiple entities receive
2771 information about an entity to which they have subscribed (in this
2772 case, network availability information). In general, a publishing
2773 entity SHOULD send a presence stanza with no 'to' attribute, in which
2774 case the server to which the entity is connected SHOULD broadcast or
2775 multiplex that stanza to all subscribing entities. However, a
2776 publishing entity MAY also send a presence stanza with a 'to'
2777 attribute, in which case the server SHOULD route or deliver that
2778 stanza to the intended recipient. See Server Rules for Handling XML
2779 Stanzas (Section 10) for general routing and delivery rules related
2780 to XML stanzas, and [XMPP-IM] for presence-specific rules in the
2781 context of an instant messaging and presence application.
2785 Info/Query, or IQ, is a request-response mechanism, similar in some
2786 ways to [HTTP]. The semantics of IQ enable an entity to make a
2787 request of, and receive a response from, another entity. The data
2788 content of the request and response is defined by the namespace
2789 declaration of a direct child element of the IQ element, and the
2790 interaction is tracked by the requesting entity through use of the
2791 'id' attribute. Thus IQ interactions follow a common pattern of
2792 structured data exchange such as get/result or set/result (although
2793 an error may be returned in reply to a request if appropriate):
2795 Requesting Responding
2799 Saint-Andre (ed.) Expires September 17, 2004 [Page 50]
2801 Internet-Draft XMPP Core March 2004
2805 ---------- ----------
2807 | <iq type='get' id='1'> |
2808 | ------------------------> |
2810 | <iq type='result' id='1'> |
2811 | <------------------------ |
2813 | <iq type='set' id='2'> |
2814 | ------------------------> |
2816 | <iq type='error' id='2'> |
2817 | <------------------------ |
2820 In order to enforce these semantics, the following rules apply:
2822 1. The 'id' attribute is REQUIRED for IQ stanzas.
2824 2. The 'type' attribute is REQUIRED for IQ stanzas. The value MUST
2825 be one of the following:
2827 * get -- The stanza is a request for information or
2830 * set -- The stanza provides required data, sets new values, or
2831 replaces existing values.
2833 * result -- The stanza is a response to a successful get or set
2836 * error -- An error has occurred regarding processing or
2837 delivery of a previously-sent get or set (see Stanza Errors
2840 3. An entity that receives an IQ request of type "get" or "set" MUST
2841 reply with an IQ response of type "result" or "error" (which
2842 response MUST preserve the 'id' attribute of the request).
2844 4. An entity that receives a stanza of type "result" or "error" MUST
2845 NOT respond to the stanza by sending a further IQ response of
2846 type "result" or "error"; however, as shown above, the requesting
2847 entity MAY send another request (e.g., an IQ of type "set" in
2848 order to provide required information discovered through a get/
2851 5. An IQ stanza of type "get" or "set" MUST contain one and only one
2855 Saint-Andre (ed.) Expires September 17, 2004 [Page 51]
2857 Internet-Draft XMPP Core March 2004
2860 child element that specifies the semantics of the particular
2861 request or response.
2863 6. An IQ stanza of type "result" MUST include zero or one child
2866 7. An IQ stanza of type "error" SHOULD include the child element
2867 contained in the associated "get" or "set" and MUST include an
2868 <error/> child; for details, see Stanza Errors (Section 9.3).
2873 Stanza-related errors are handled in a manner similar to stream
2874 errors (Section 4.7). However, unlike stream errors, stanza errors
2875 are recoverable; therefore error stanzas include hints regarding
2876 actions that the original sender can take in order to remedy the
2881 The following rules apply to stanza-related errors:
2883 o The receiving or processing entity that detects an error condition
2884 in relation to a stanza MUST return to the sending entity a stanza
2885 of the same kind (message, presence, or IQ) whose 'type' attribute
2886 is set to a value of "error" (such a stanza is called an "error
2889 o The entity that generates an error stanza SHOULD include the
2890 original XML sent so that the sender can inspect and if necessary
2891 correct the XML before attempting to resend.
2893 o An error stanza MUST contain an <error/> child element.
2895 o An <error/> child MUST NOT be included if the 'type' attribute has
2896 a value other than "error" (or if there is no 'type' attribute).
2898 o An entity that receives an error stanza MUST NOT respond to the
2899 stanza with a further error stanza; this helps to prevent looping.
2904 The syntax for stanza-related errors is as follows:
2906 <stanza-kind to='sender' type='error'>
2907 [RECOMMENDED to include sender XML here]
2911 Saint-Andre (ed.) Expires September 17, 2004 [Page 52]
2913 Internet-Draft XMPP Core March 2004
2916 <error type='error-type'>
2917 <defined-condition xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
2918 <text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
2919 OPTIONAL descriptive text
2921 [OPTIONAL application-specific condition element]
2925 The stanza-kind is one of message, presence, or iq.
2927 The value of the <error/> element's 'type' attribute MUST be one of
2930 o cancel -- do not retry (the error is unrecoverable)
2932 o continue -- proceed (the condition was only a warning)
2934 o modify -- retry after changing the data sent
2936 o auth -- retry after providing credentials
2938 o wait -- retry after waiting (the error is temporary)
2940 The <error/> element:
2942 o MUST contain a child element corresponding to one of the defined
2943 stanza error conditions specified below; this element MUST be
2944 qualified by the 'urn:ietf:params:xml:ns:xmpp-stanzas' namespace.
2946 o MAY contain a <text/> child containing XML character data that
2947 describes the error in more detail; this element MUST be qualified
2948 by the 'urn:ietf:params:xml:ns:xmpp-stanzas' namespace and SHOULD
2949 possess an 'xml:lang' attribute.
2951 o MAY contain a child element for an application-specific error
2952 condition; this element MUST be qualified by an
2953 application-defined namespace, and its structure is defined by
2956 The <text/> element is OPTIONAL. If included, it SHOULD be used only
2957 to provide descriptive or diagnostic information that supplements the
2958 meaning of a defined condition or application-specific condition. It
2959 SHOULD NOT be interpreted programmatically by an application. It
2960 SHOULD NOT be used as the error message presented to a user, but MAY
2961 be shown in addition to the error message associated with the
2962 included condition element (or elements).
2967 Saint-Andre (ed.) Expires September 17, 2004 [Page 53]
2969 Internet-Draft XMPP Core March 2004
2972 Finally, to maintain backward compatibility, the schema (specified in
2973 [XMPP-IM]) allows the optional inclusion of a 'code' attribute on the
2976 9.3.3 Defined Conditions
2978 The following conditions are defined for use in stanza errors.
2980 o <bad-request/> -- the sender has sent XML that is malformed or
2981 that cannot be processed (e.g., an IQ stanza that includes an
2982 unrecognized value of the 'type' attribute); the associated error
2983 type SHOULD be "modify".
2985 o <conflict/> -- access cannot be granted because an existing
2986 resource or session exists with the same name or address; the
2987 associated error type SHOULD be "cancel".
2989 o <feature-not-implemented/> -- the feature requested is not
2990 implemented by the recipient or server and therefore cannot be
2991 processed; the associated error type SHOULD be "cancel".
2993 o <forbidden/> -- the requesting entity does not possess the
2994 required permissions to perform the action; the associated error
2995 type SHOULD be "auth".
2997 o <gone/> -- the recipient or server can no longer be contacted at
2998 this address (the error stanza MAY contain a new address in the
2999 XML character data of the <gone/> element); the associated error
3000 type SHOULD be "modify".
3002 o <internal-server-error/> -- the server could not process the
3003 stanza because of a misconfiguration or an otherwise-undefined
3004 internal server error; the associated error type SHOULD be "wait".
3006 o <item-not-found/> -- the addressed JID or item requested cannot be
3007 found; the associated error type SHOULD be "cancel".
3009 o <jid-malformed/> -- the sending entity has provided or
3010 communicated an XMPP address (e.g., a value of the 'to' attribute)
3011 or aspect thereof (e.g., a resource identifier) that does not
3012 adhere to the syntax defined in Addressing Scheme (Section 3); the
3013 associated error type SHOULD be "modify".
3015 o <not-acceptable/> -- the recipient or server understands the
3016 request but is refusing to process it because it does not meet
3017 criteria defined by the recipient or server (e.g., a local policy
3018 regarding acceptable words in messages); the associated error type
3023 Saint-Andre (ed.) Expires September 17, 2004 [Page 54]
3025 Internet-Draft XMPP Core March 2004
3028 o <not-allowed/> -- the recipient or server does not allow any
3029 entity to perform the action; the associated error type SHOULD be
3032 o <not-authorized/> -- the sender must provide proper credentials
3033 before being allowed to perform the action, or has provided
3034 improper credentials; the associated error type SHOULD be "auth".
3036 o <payment-required/> -- the requesting entity is not authorized to
3037 access the requested service because payment is required; the
3038 associated error type SHOULD be "auth".
3040 o <recipient-unavailable/> -- the intended recipient is temporarily
3041 unavailable; the associated error type SHOULD be "wait" (note: an
3042 application MUST NOT return this error if doing so would provide
3043 information about the intended recipient's network availability to
3044 an entity that is not authorized to know such information).
3046 o <redirect/> -- the recipient or server is redirecting requests for
3047 this information to another entity, usually temporarily (the error
3048 stanza SHOULD contain the alternate address, which MUST be a valid
3049 JID, in the XML character data of the <redirect/> element); the
3050 associated error type SHOULD be "modify".
3052 o <registration-required/> -- the requesting entity is not
3053 authorized to access the requested service because registration is
3054 required; the associated error type SHOULD be "auth".
3056 o <remote-server-not-found/> -- a remote server or service specified
3057 as part or all of the JID of the intended recipient does not
3058 exist; the associated error type SHOULD be "cancel".
3060 o <remote-server-timeout/> -- a remote server or service specified
3061 as part or all of the JID of the intended recipient (or required
3062 to fulfill a request) could not be contacted within a reasonable
3063 amount of time; the associated error type SHOULD be "wait".
3065 o <resource-constraint/> -- the server or recipient lacks the system
3066 resources necessary to service the request; the associated error
3067 type SHOULD be "wait".
3069 o <service-unavailable/> -- the server or recipient does not
3070 currently provide the requested service; the associated error type
3073 o <subscription-required/> -- the requesting entity is not
3074 authorized to access the requested service because a subscription
3075 is required; the associated error type SHOULD be "auth".
3079 Saint-Andre (ed.) Expires September 17, 2004 [Page 55]
3081 Internet-Draft XMPP Core March 2004
3084 o <undefined-condition/> -- the error condition is not one of those
3085 defined by the other conditions in this list; any error type may
3086 be associated with this condition, and it SHOULD be used only in
3087 conjunction with an application-specific condition.
3089 o <unexpected-request/> -- the recipient or server understood the
3090 request but was not expecting it at this time (e.g., the request
3091 was out of order); the associated error type SHOULD be "wait".
3094 9.3.4 Application-Specific Conditions
3096 As noted, an application MAY provide application-specific stanza
3097 error information by including a properly-namespaced child in the
3098 error element. The application-specific element SHOULD supplement or
3099 further qualify a defined element. Thus the <error/> element will
3100 contain two or three child elements:
3102 <iq type='error' id='some-id'>
3103 <error type='modify'>
3104 <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
3105 <too-many-parameters xmlns='application-ns'/>
3110 <message type='error' id='another-id'>
3111 <error type='modify'>
3112 <undefined-condition
3113 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
3115 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>
3116 Some special application diagnostic information...
3118 <special-application-condition xmlns='application-ns'/>
3123 10. Server Rules for Handling XML Stanzas
3125 Compliant server implementations MUST ensure in-order processing of
3126 XML stanzas between any two entities.
3128 Beyond the requirement for in-order processing, each server
3129 implementation will contain its own "delivery tree" for handling
3130 stanzas it receives. Such a tree determines whether a stanza needs
3131 to be routed to another domain, processed internally, or delivered to
3135 Saint-Andre (ed.) Expires September 17, 2004 [Page 56]
3137 Internet-Draft XMPP Core March 2004
3140 a resource associated with a connected node. The following rules
3141 apply to a "mere" XMPP server, but MAY be further specified or
3142 overridden by a particular class of application servers (e.g., an
3143 instant messaging and presence server as defined in [XMPP-IM]):
3145 10.1 No 'to' Address
3147 If the stanza possesses no 'to' attribute, the server SHOULD process
3148 it on behalf of the entity that sent it. Because all stanzas
3149 received from other servers MUST possess a 'to' attribute, this rule
3150 applies only to stanzas received from a registered entity (such as a
3151 client) that is connected to the server. If the server receives a
3152 presence stanza with no 'to' attribute, the server SHOULD broadcast
3153 it to the entities that are subscribed to the sending entity's
3154 presence, if applicable (the semantics of presence broadcast for
3155 instant messaging and presence applications are defined in
3156 [XMPP-IM]). If the server receives an IQ stanza of type "get" or
3157 "set" with no 'to' attribute and it understands the namespace that
3158 qualifies the content of the stanza, it MUST either process the
3159 stanza on behalf of sending entity (where the meaning of "process" is
3160 determined by the semantics of the qualifying namespace) or return an
3161 error to the sending entity.
3165 If the hostname of the domain identifier portion of the JID contained
3166 in the 'to' attribute does not match one of the configured hostnames
3167 of the server itself or a subdomain thereof, the server SHOULD route
3168 the stanza to the foreign domain (subject to local service
3169 provisioning and security policies regarding inter-domain
3170 communication). There are two possible cases:
3172 A server-to-server stream already exists between the two domains: The
3173 sender's server routes the stanza to the authoritative server for
3174 the foreign domain over the existing stream
3176 There exists no server-to-server stream between the two domains: The
3177 sender's server (1) resolves the hostname of the foreign domain
3178 (as defined under Server-to-Server Communications (Section 14.4)),
3179 (2) negotiates a server-to-server stream between the two domains
3180 (as defined under Use of TLS (Section 5) and Use of SASL (Section
3181 6)), and (3) routes the stanza to the authoritative server for the
3182 foreign domain over the newly-established stream
3184 If routing to the recipient's server is unsuccessful, the sender's
3185 server MUST return an error to the sender; if the recipient's server
3186 can be contacted but delivery by the recipient's server to the
3187 recipient is unsuccessful, the recipient's server MUST return an
3191 Saint-Andre (ed.) Expires September 17, 2004 [Page 57]
3193 Internet-Draft XMPP Core March 2004
3196 error to the sender by way of the sender's server.
3200 If the hostname of the domain identifier portion of the JID contained
3201 in the 'to' attribute matches a subdomain of one of the configured
3202 hostnames of the server itself, the server MUST either process the
3203 stanza itself or route the stanza to a specialized service that is
3204 responsible for that subdomain (if the subdomain is configured), or
3205 return an error to the sender (if the subdomain is not configured).
3207 10.4 Mere Domain or Specific Resource
3209 If the hostname of the domain identifier portion of the JID contained
3210 in the 'to' attribute matches a configured hostname of the server
3211 itself and the JID contained in the 'to' attribute is of the form
3212 <domain> or <domain/resource>, the server (or a defined resource
3213 thereof) MUST either process the stanza as appropriate for the stanza
3214 kind or return an error stanza to the sender.
3216 10.5 Node in Same Domain
3218 If the hostname of the domain identifier portion of the JID contained
3219 in the 'to' attribute matches a configured hostname of the server
3220 itself and the JID contained in the 'to' attribute is of the form
3221 <node@domain> or <node@domain/resource>, the server SHOULD deliver
3222 the stanza to the intended recipient of the stanza as represented by
3223 the JID contained in the 'to' attribute. The following rules apply:
3225 1. If the JID contains a resource identifier (i.e., is of the form
3226 <node@domain/resource>) and there exists a connected resource
3227 that matches the full JID, the recipient's server SHOULD deliver
3228 the stanza to the stream or session that exactly matches the
3229 resource identifier.
3231 2. If the JID contains a resource identifier and there exists no
3232 connected resource that matches the full JID, the recipient's
3233 server SHOULD return a <service-unavailable/> stanza error to the
3236 3. If the JID is of the form <node@domain> and there exists at least
3237 one connected resource for the node, the recipient's server
3238 SHOULD deliver the stanza to at least one of the connected
3239 resources, according to application-specific rules (a set of
3240 delivery rules for instant messaging and presence applications is
3241 defined in [XMPP-IM]).
3247 Saint-Andre (ed.) Expires September 17, 2004 [Page 58]
3249 Internet-Draft XMPP Core March 2004
3252 11. XML Usage within XMPP
3256 XMPP is a simplified and specialized protocol for streaming XML
3257 elements in order to exchange structured information in close to real
3258 time. Because XMPP does not require the parsing of arbitrary and
3259 complete XML documents, there is no requirement that XMPP needs to
3260 support the full feature set of [XML]. In particular, the following
3263 With regard to XML generation, an XMPP implementation MUST NOT inject
3264 into an XML stream any of the following:
3266 o comments (as defined in Section 2.5 of [XML])
3268 o processing instructions (Section 2.6 therein)
3270 o internal or external DTD subsets (Section 2.8 therein)
3272 o internal or external entity references (Section 4.2 therein) with
3273 the exception of predefined entities (Section 4.6 therein)
3275 o character data or attribute values containing unescaped characters
3276 that map to the predefined entities (Section 4.6 therein); such
3277 characters MUST be escaped
3279 With regard to XML processing, if an XMPP implementation receives
3280 such restricted XML data, it MUST ignore the data.
3282 11.2 XML Namespace Names and Prefixes
3284 XML Namespaces [XML-NAMES] are used within all XMPP-compliant XML to
3285 create strict boundaries of data ownership. The basic function of
3286 namespaces is to separate different vocabularies of XML elements that
3287 are structurally mixed together. Ensuring that XMPP-compliant XML is
3288 namespace-aware enables any allowable XML to be structurally mixed
3289 with any data element within XMPP. Rules for XML namespace names and
3290 prefixes are defined in the following subsections.
3292 11.2.1 Streams Namespace
3294 A streams namespace declaration is REQUIRED in all XML stream
3295 headers. The name of the streams namespace MUST be 'http://
3296 etherx.jabber.org/streams'. The element names of the <stream/>
3297 element and its <features/> and <error/> children MUST be qualified
3298 by the streams namespace prefix in all instances. An implementation
3299 SHOULD generate only the 'stream:' prefix for these elements, and for
3303 Saint-Andre (ed.) Expires September 17, 2004 [Page 59]
3305 Internet-Draft XMPP Core March 2004
3308 historical reasons MAY accept only the 'stream:' prefix.
3310 11.2.2 Default Namespace
3312 A default namespace declaration is REQUIRED and is used in all XML
3313 streams in order to define the allowable first-level children of the
3314 root stream element. This namespace declaration MUST be the same for
3315 the initial stream and the response stream so that both streams are
3316 qualified consistently. The default namespace declaration applies to
3317 the stream and all stanzas sent within a stream (unless explicitly
3318 qualified by another namespace, or by the prefix of the streams
3319 namespace or the dialback namespace).
3321 A server implementation MUST support the following two default
3322 namespaces (for historical reasons, some implementations MAY support
3323 only these two default namespaces):
3325 o jabber:client -- this default namespace is declared when the
3326 stream is used for communications between a client and a server
3328 o jabber:server -- this default namespace is declared when the
3329 stream is used for communications between two servers
3331 A client implementation MUST support the 'jabber:client' default
3332 namespace, and for historical reasons MAY support only that default
3335 An implementation MUST NOT generate namespace prefixes for elements
3336 in the default namespace if the default namespace is 'jabber:client'
3337 or 'jabber:server'. An implementation SHOULD NOT generate namespace
3338 prefixes for elements qualified by content (as opposed to stream)
3339 namespaces other than 'jabber:client' and 'jabber:server'.
3341 Note: The 'jabber:client' and 'jabber:server' namespaces are nearly
3342 identical but are used in different contexts (client-to-server
3343 communications for 'jabber:client' and server-to-server
3344 communications for 'jabber:server'). The only difference between the
3345 two is that the 'to' and 'from' attributes are OPTIONAL on stanzas
3346 sent within 'jabber:client', whereas they are REQUIRED on stanzas
3347 sent within 'jabber:server'. If a compliant implementation accepts a
3348 stream that is qualified by the 'jabber:client' or 'jabber:server'
3349 namespace, it MUST support the common attributes (Section 9.1) and
3350 basic semantics (Section 9.2) of all three core stanza kinds
3351 (message, presence, and IQ).
3353 11.2.3 Dialback Namespace
3355 A dialback namespace declaration is REQUIRED for all elements used in
3359 Saint-Andre (ed.) Expires September 17, 2004 [Page 60]
3361 Internet-Draft XMPP Core March 2004
3364 server dialback (Section 8). The name of the dialback namespace MUST
3365 be 'jabber:server:dialback'. All elements qualified by this
3366 namespace MUST be prefixed. An implementation SHOULD generate only
3367 the 'db:' prefix for such elements and MAY accept only the 'db:'
3372 Except as noted with regard to 'to' and 'from' addresses for stanzas
3373 within the 'jabber:server' namespace, a server is not responsible for
3374 validating the XML elements forwarded to a client or another server;
3375 an implementation MAY choose to provide only validated data elements
3376 but this is OPTIONAL (although an implementation MUST NOT accept XML
3377 that is not well-formed). Clients SHOULD NOT rely on the ability to
3378 send data which does not conform to the schemas, and SHOULD ignore
3379 any non-conformant elements or attributes on the incoming XML stream.
3380 Validation of XML streams and stanzas is OPTIONAL, and schemas are
3381 included herein for descriptive purposes only.
3383 11.4 Inclusion of Text Declaration
3385 Implementations SHOULD send a text declaration before sending a
3386 stream header. Applications MUST follow the rules in [XML] regarding
3387 the circumstances under which a text declaration is included.
3389 11.5 Character Encoding
3391 Implementations MUST support the UTF-8 (RFC 3269 [UTF-8])
3392 transformation of Universal Character Set (ISO/IEC 10646-1 [UCS2])
3393 characters, as required by RFC 2277 [CHARSET]. Implementations MUST
3394 NOT attempt to use any other encoding.
3396 12. Core Compliance Requirements
3398 This section summarizes the specific aspects of the Extensible
3399 Messaging and Presence Protocol that MUST be supported by servers and
3400 clients in order to be considered compliant implementations, as well
3401 as additional protocol aspects that SHOULD be supported. For
3402 compliance purposes, we draw a distinction between core protocols
3403 (which MUST be supported by any server or client, regardless of the
3404 specific application) and instant messaging protocols (which MUST be
3405 supported only by instant messaging and presence applications built
3406 on top of the core protocols). Compliance requirements that apply to
3407 all servers and clients are specified in this section; compliance
3408 requirements for instant messaging servers and clients are specified
3409 in the corresponding section of [XMPP-IM].
3415 Saint-Andre (ed.) Expires September 17, 2004 [Page 61]
3417 Internet-Draft XMPP Core March 2004
3422 In addition to all defined requirements with regard to security, XML
3423 usage, and internationalization, a server MUST support the following
3424 core protocols in order to be considered compliant:
3426 o Application of the [NAMEPREP], Nodeprep (Appendix A), and
3427 Resourceprep (Appendix B) profiles of [STRINGPREP] to addresses
3428 (including ensuring that domain identifiers are internationalized
3429 domain names as defined in [IDNA])
3431 o XML streams (Section 4), including Use of TLS (Section 5), Use of
3432 SASL (Section 6), and Resource Binding (Section 7)
3434 o The basic semantics of the three defined stanza kinds (i.e.,
3435 <message/>, <presence/>, and <iq/>) as specified in stanza
3436 semantics (Section 9.2)
3438 o Generation (and, where appropriate, handling) of error syntax and
3439 semantics related to streams, TLS, SASL, and XML stanzas
3441 In addition, a server SHOULD support the following core protocol:
3443 o Server dialback (Section 8)
3448 A client MUST support the following core protocols in order to be
3449 considered compliant:
3451 o XML streams (Section 4), including Use of TLS (Section 5), Use of
3452 SASL (Section 6), and Resource Binding (Section 7)
3454 o The basic semantics of the three defined stanza kinds (i.e.,
3455 <message/>, <presence/>, and <iq/>) as specified in stanza
3456 semantics (Section 9.2)
3458 o Handling (and, where appropriate, generation) of error syntax and
3459 semantics related to streams, TLS, SASL, and XML stanzas
3461 In addition, a client SHOULD support the following core protocols:
3463 o Generation of addresses to which the [NAMEPREP], Nodeprep
3464 (Appendix A), and Resourceprep (Appendix B) profiles of
3465 [STRINGPREP] can be applied without failing
3471 Saint-Andre (ed.) Expires September 17, 2004 [Page 62]
3473 Internet-Draft XMPP Core March 2004
3476 13. Internationalization Considerations
3478 XML streams MUST be encoded in UTF-8 as specified under Character
3479 Encoding (Section 11.5). As specified under Stream Attributes
3480 (Section 4.4), an XML stream SHOULD include an 'xml:lang' attribute
3481 that is treated as the default language for any XML character data
3482 sent over the stream that is intended to be presented to a human
3483 user. As specified under xml:lang (Section 9.1.5), an XML stanza
3484 SHOULD include an 'xml:lang' attribute if the stanza contains XML
3485 character data that is intended to be presented to a human user. A
3486 server SHOULD apply the default 'xml:lang' attribute to stanzas it
3487 routes or delivers on behalf of connected entities, and MUST NOT
3488 modify or delete 'xml:lang' attributes from stanzas it receives from
3491 14. Security Considerations
3495 For the purposes of XMPP communications (client-to-server and
3496 server-to-server), the term "high security" refers to the use of
3497 security technologies that provide both mutual authentication and
3498 integrity-checking; in particular, when using certificate-based
3499 authentication to provide high security, a chain-of-trust SHOULD be
3500 established out-of-band, although a shared certificate authority
3501 signing certificates could allow a previously unknown certificate to
3502 establish trust in-band. See Section 14.2 below regarding
3503 certificate validation procedures.
3505 Implementations MUST support high security. Service provisioning
3506 SHOULD use high security, subject to local security policies.
3508 14.2 Certificate Validation
3510 When an XMPP peer communicates with another peer securely, it MUST
3511 validate the peer's certificate. There are three possible cases:
3513 Case #1: The peer contains an End Entity certificate which appears to
3514 be certified by a chain of certificates terminating in a trust
3515 anchor (as described in Section 6.1 of [X509]).
3517 Case #2: The peer certificate is certified by a Certificate Authority
3518 not known to the validating peer.
3520 Case #3: The peer certificate is self-signed.
3522 In Case #1, the validating peer MUST do one of two things:
3527 Saint-Andre (ed.) Expires September 17, 2004 [Page 63]
3529 Internet-Draft XMPP Core March 2004
3532 1. Verify the peer certificate according to the rules of [X509].
3533 The certificate SHOULD then be checked against the expected
3534 identity of the peer following the rules described in [HTTP-TLS],
3535 except that a subjectAltName extension of type "xmpp" MUST be
3536 used as the identity if present. If one of these checks fails,
3537 user-oriented clients MUST either notify the user (clients MAY
3538 give the user the opportunity to continue with the connection in
3539 any case) or terminate the connection with a bad certificate
3540 error. Automated clients SHOULD terminate the connection (with a
3541 bad certificate error) and log the error to an appropriate audit
3542 log. Automated clients MAY provide a configuration setting that
3543 disables this check, but MUST provide a setting which enables it.
3545 2. The peer SHOULD show the certificate to a user for approval,
3546 including the entire certificate chain. The peer MUST cache the
3547 certificate (or some non-forgeable representation such as a
3548 hash). In future connections, the peer MUST verify that the same
3549 certificate was presented and MUST notify the user if it has
3552 In Case #2 and Case #3, implementations SHOULD act as in (2) above.
3554 14.3 Client-to-Server Communications
3556 A compliant client implementation MUST support both TLS and SASL for
3557 connections to a server.
3559 The TLS protocol for encrypting XML streams (defined under Use of TLS
3560 (Section 5)) provides a reliable mechanism for helping to ensure the
3561 confidentiality and data integrity of data exchanged between two
3564 The SASL protocol for authenticating XML streams (defined under Use
3565 of SASL (Section 6)) provides a reliable mechanism for validating
3566 that a client connecting to a server is who it claims to be.
3568 Client-to-server communications MUST NOT proceed until the DNS
3569 hostname asserted by the server has been resolved. Such resolutions
3570 SHOULD first attempt to resolve the hostname using an [SRV] Service
3571 of "xmpp-client" and Proto of "tcp", resulting in resource records
3572 such as "_xmpp-client._tcp.example.com." (the use of the string
3573 "xmpp-client" for the service identifier is consistent with the IANA
3574 registration). If the SRV lookup fails, the fallback is a normal
3575 IPv4/IPv6 address record resolution to determine the IP address,
3576 using the "xmpp-client" port of 5222 registered with the IANA.
3578 The IP address and method of access of clients MUST NOT be made
3579 public by a server, nor are any connections other than the original
3583 Saint-Andre (ed.) Expires September 17, 2004 [Page 64]
3585 Internet-Draft XMPP Core March 2004
3588 server connection required. This helps to protect the client's
3589 server from direct attack or identification by third parties.
3591 14.4 Server-to-Server Communications
3593 A compliant server implementation MUST support both TLS and SASL for
3594 inter-domain communications. For historical reasons, a compliant
3595 implementation SHOULD also support Server Dialback (Section 8).
3597 Because service provisioning is a matter of policy, it is OPTIONAL
3598 for any given domain to communicate with other domains, and
3599 server-to-server communications MAY be disabled by the administrator
3600 of any given deployment. If a particular domain enables inter-domain
3601 communications, it SHOULD enable high security.
3603 Administrators may want to require use of SASL for server-to-server
3604 communications in order to ensure both authentication and
3605 confidentiality (e.g., on an organization's private network).
3606 Compliant implementations SHOULD support SASL for this purpose.
3608 Inter-domain connections MUST NOT proceed until the DNS hostnames
3609 asserted by the servers have been resolved. Such resolutions MUST
3610 first attempt to resolve the hostname using an [SRV] Service of
3611 "xmpp-server" and Proto of "tcp", resulting in resource records such
3612 as "_xmpp-server._tcp.example.com." (the use of the string
3613 "xmpp-server" for the service identifier is consistent with the IANA
3614 registration; note well that the "xmpp-server" service identifier
3615 supersedes the earlier use of a "jabber" service identifier, since
3616 the earlier usage did not conform to [SRV]; implementations desiring
3617 to be backward compatible should continue to look for or answer to
3618 the "jabber" service identifier as well). If the SRV lookup fails,
3619 the fallback is a normal IPv4/IPv6 address record resolution to
3620 determine the IP address, using the "xmpp-server" port of 5269
3621 registered with the IANA.
3623 Server dialback helps protect against domain spoofing, thus making it
3624 more difficult to spoof XML stanzas. It is not a mechanism for
3625 authenticating, securing, or encrypting streams between servers as is
3626 done via SASL and TLS, and results in weak verification of server
3627 identities only. Furthermore, it is susceptible to DNS poisoning
3628 attacks unless DNSSec [DNSSEC] is used, and even if the DNS
3629 information is accurate, dialback cannot protect from attacks where
3630 the attacker is capable of hijacking the IP address of the remote
3631 domain. Domains requiring robust security SHOULD use TLS and SASL.
3632 If SASL is used for server-to-server authentication, dialback SHOULD
3633 NOT be used since it is unnecessary.
3639 Saint-Andre (ed.) Expires September 17, 2004 [Page 65]
3641 Internet-Draft XMPP Core March 2004
3644 14.5 Order of Layers
3646 The order of layers in which protocols MUST be stacked is as follows:
3656 The rationale for this order is that [TCP] is the base connection
3657 layer used by all of the protocols stacked on top of TCP, [TLS] is
3658 often provided at the operating system layer, [SASL] is often
3659 provided at the application layer, and XMPP is the application
3662 14.6 Lack of SASL Channel Binding to TLS
3664 The SASL framework does not provide a mechanism to bind SASL
3665 authentication to a security layer providing confidentiality and
3666 integrity protection that was negotiated at a lower layer. This lack
3667 of a "channel binding" prevents SASL from being able to verify that
3668 the source and destination end points to which the lower layer's
3669 security is bound are equivalent to the end points that SASL is
3670 authenticating. If the end points are not identical, the lower
3671 layer's security cannot be trusted to protect data transmitted
3672 between the SASL authenticated entities. In such a situation, a SASL
3673 security layer should be negotiated which effectively ignores the
3674 presence of the lower layer security.
3676 14.7 Mandatory-to-Implement Technologies
3678 At a minimum, all implementations MUST support the following
3681 for authentication: the SASL [DIGEST-MD5] mechanism
3683 for confidentiality: TLS (using the TLS_RSA_WITH_3DES_EDE_CBC_SHA
3686 for both: TLS plus SASL EXTERNAL(using the
3687 TLS_RSA_WITH_3DES_EDE_CBC_SHA cipher supporting client-side
3695 Saint-Andre (ed.) Expires September 17, 2004 [Page 66]
3697 Internet-Draft XMPP Core March 2004
3702 Communications using XMPP normally occur over [TCP] connections on
3703 port 5222 (client-to-server) or port 5269 (server-to-server), as
3704 registered with the IANA (see IANA Considerations (Section 15)). Use
3705 of these well-known ports allows administrators to easily enable or
3706 disable XMPP activity through existing and commonly-deployed
3709 14.9 Use of base64 in SASL
3711 Both the client and the server MUST verify any [BASE64] data received
3712 during SASL negotiation. An implementation MUST reject (not ignore)
3713 any characters that are not explicitly allowed by the base64
3714 alphabet; this helps to guard against creation of a covert channel
3715 that could be used to "leak" information. An implementation MUST NOT
3716 break on invalid input and MUST reject any sequence of base64
3717 characters containing the pad ('=') character if that character is
3718 included as something other than the last character of the data (e.g.
3719 "=AAA" or "BBBB=CCC"); this helps to guard against buffer overflow
3720 attacks and other attacks on the implementation. Base encoding
3721 visually hides otherwise easily recognized information, such as
3722 passwords, but does not provide any computational confidentiality.
3723 Base 64 encoding MUST follow the definition in Section 3 of RFC 3548
3726 14.10 Stringprep Profiles
3728 XMPP makes use of the [NAMEPREP] profile of [STRINGPREP] for
3729 processing of domain identifiers; for security considerations related
3730 to Nameprep, refer to the appropriate section of [NAMEPREP].
3732 In addition, XMPP defines two profiles of [STRINGPREP]: Nodeprep
3733 (Appendix A) for node identifiers and Resourceprep (Appendix B) for
3734 resource identifiers.
3736 The Unicode and ISO/IEC 10646 repertoires have many characters that
3737 look similar. In many cases, users of security protocols might do
3738 visual matching, such as when comparing the names of trusted third
3739 parties. Because it is impossible to map similar-looking characters
3740 without a great deal of context such as knowing the fonts used,
3741 stringprep does nothing to map similar-looking characters together
3742 nor to prohibit some characters because they look like others.
3744 A node identifier can be employed as one part of an entity's address
3745 in XMPP. One common usage is as the username of an instant messaging
3746 user; another is as the name of a multi-user chat room; and many
3747 other kinds of entities could use node identifiers as part of their
3751 Saint-Andre (ed.) Expires September 17, 2004 [Page 67]
3753 Internet-Draft XMPP Core March 2004
3756 addresses. The security of such services could be compromised based
3757 on different interpretations of the internationalized node
3758 identifier; for example, a user entering a single internationalized
3759 node identifier could access another user's account information, or a
3760 user could gain access to an otherwise restricted chat room or
3763 A resource identifier can be employed as one part of an entity's
3764 address in XMPP. One common usage is as the name for an instant
3765 messaging user's connected resource (active session); another is as
3766 the nickname of a user in a multi-user chat room; and many other
3767 kinds of entities could use resource identifiers as part of their
3768 addresses. The security of such services could be compromised based
3769 on different interpretations of the internationalized resource
3770 identifier; for example, a user could attempt to initiate multiple
3771 sessions with the same name, or a user could send a message to
3772 someone other than the intended recipient in a multi-user chat room.
3774 15. IANA Considerations
3776 15.1 XML Namespace Name for TLS Data
3778 A URN sub-namespace for TLS-related data in the Extensible Messaging
3779 and Presence Protocol (XMPP) is defined as follows. (This namespace
3780 name adheres to the format defined in The IETF XML Registry
3783 URI: urn:ietf:params:xml:ns:xmpp-tls
3787 Description: This is the XML namespace name for TLS-related data in
3788 the Extensible Messaging and Presence Protocol (XMPP) as defined
3791 Registrant Contact: IETF, XMPP Working Group, <xmppwg@jabber.org>
3794 15.2 XML Namespace Name for SASL Data
3796 A URN sub-namespace for SASL-related data in the Extensible Messaging
3797 and Presence Protocol (XMPP) is defined as follows. (This namespace
3798 name adheres to the format defined in [XML-REG].)
3800 URI: urn:ietf:params:xml:ns:xmpp-sasl
3807 Saint-Andre (ed.) Expires September 17, 2004 [Page 68]
3809 Internet-Draft XMPP Core March 2004
3814 Description: This is the XML namespace name for SASL-related data in
3815 the Extensible Messaging and Presence Protocol (XMPP) as defined
3818 Registrant Contact: IETF, XMPP Working Group, <xmppwg@jabber.org>
3821 15.3 XML Namespace Name for Stream Errors
3823 A URN sub-namespace for stream-related error data in the Extensible
3824 Messaging and Presence Protocol (XMPP) is defined as follows. (This
3825 namespace name adheres to the format defined in [XML-REG].)
3827 URI: urn:ietf:params:xml:ns:xmpp-streams
3831 Description: This is the XML namespace name for stream-related error
3832 data in the Extensible Messaging and Presence Protocol (XMPP) as
3835 Registrant Contact: IETF, XMPP Working Group, <xmppwg@jabber.org>
3838 15.4 XML Namespace Name for Resource Binding
3840 A URN sub-namespace for resource binding in the Extensible Messaging
3841 and Presence Protocol (XMPP) is defined as follows. (This namespace
3842 name adheres to the format defined in [XML-REG].)
3844 URI: urn:ietf:params:xml:ns:xmpp-bind
3848 Description: This is the XML namespace name for resource binding in
3849 the Extensible Messaging and Presence Protocol (XMPP) as defined
3852 Registrant Contact: IETF, XMPP Working Group, <xmppwg@jabber.org>
3855 15.5 XML Namespace Name for Stanza Errors
3857 A URN sub-namespace for stanza-related error data in the Extensible
3858 Messaging and Presence Protocol (XMPP) is defined as follows. (This
3859 namespace name adheres to the format defined in [XML-REG].)
3863 Saint-Andre (ed.) Expires September 17, 2004 [Page 69]
3865 Internet-Draft XMPP Core March 2004
3868 URI: urn:ietf:params:xml:ns:xmpp-stanzas
3872 Description: This is the XML namespace name for stanza-related error
3873 data in the Extensible Messaging and Presence Protocol (XMPP) as
3876 Registrant Contact: IETF, XMPP Working Group, <xmppwg@jabber.org>
3879 15.6 Nodeprep Profile of Stringprep
3881 The Nodeprep profile of stringprep is defined under Nodeprep
3882 (Appendix A). The IANA registers Nodeprep in the stringprep profile
3885 Name of this profile:
3889 RFC in which the profile is defined:
3893 Indicator whether or not this is the newest version of the profile:
3895 This is the first version of Nodeprep
3898 15.7 Resourceprep Profile of Stringprep
3900 The Resourceprep profile of stringprep is defined under Resourceprep
3901 (Appendix B). The IANA registers Resourceprep in the stringprep
3904 Name of this profile:
3908 RFC in which the profile is defined:
3912 Indicator whether or not this is the newest version of the profile:
3919 Saint-Andre (ed.) Expires September 17, 2004 [Page 70]
3921 Internet-Draft XMPP Core March 2004
3924 This is the first version of Resourceprep
3927 15.8 GSSAPI Service Name
3929 The IANA registers "xmpp" as a GSSAPI [GSS-API] service name, as
3930 defined under SASL Definition (Section 6.3).
3934 The IANA registers "xmpp-client" and "xmpp-server" as keywords for
3935 [TCP] ports 5222 and 5269 respectively.
3937 These ports SHOULD be used for client-to-server and server-to-server
3938 communications respectively, but their use is OPTIONAL.
3940 Normative References
3942 [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax
3943 Specifications: ABNF", RFC 2234, November 1997.
3945 [BASE64] Josefsson, S., "The Base16, Base32, and Base64 Data
3946 Encodings", RFC 3548, July 2003.
3948 [CHARSET] Alvestrand, H., "IETF Policy on Character Sets and
3949 Languages", BCP 18, RFC 2277, January 1998.
3952 Leach, P. and C. Newman, "Using Digest Authentication as a
3953 SASL Mechanism", RFC 2831, May 2000.
3955 [DNS] Mockapetris, P., "Domain names - implementation and
3956 specification", STD 13, RFC 1035, November 1987.
3958 [GSS-API] Linn, J., "Generic Security Service Application Program
3959 Interface, Version 2", RFC 2078, January 1997.
3962 Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.
3964 [IDNA] Faltstrom, P., Hoffman, P. and A. Costello,
3965 "Internationalizing Domain Names in Applications (IDNA)",
3966 RFC 3490, March 2003.
3969 Day, M., Aggarwal, S. and J. Vincent, "Instant Messaging /
3970 Presence Protocol Requirements", RFC 2779, February 2000.
3975 Saint-Andre (ed.) Expires September 17, 2004 [Page 71]
3977 Internet-Draft XMPP Core March 2004
3980 [IPv6] Hinden, R. and S. Deering, "IP Version 6 Addressing
3981 Architecture", RFC 2373, July 1998.
3984 Alvestrand, H., "Tags for the Identification of
3985 Languages", BCP 47, RFC 3066, January 2001.
3988 Hoffman, P. and M. Blanchet, "Nameprep: A Stringprep
3989 Profile for Internationalized Domain Names (IDN)", RFC
3992 [SASL] Myers, J., "Simple Authentication and Security Layer
3993 (SASL)", RFC 2222, October 1997.
3995 [SRV] Gulbrandsen, A., Vixie, P. and L. Esibov, "A DNS RR for
3996 specifying the location of services (DNS SRV)", RFC 2782,
4000 Hoffman, P. and M. Blanchet, "Preparation of
4001 Internationalized Strings ("STRINGPREP")", RFC 3454,
4004 [TCP] Postel, J., "Transmission Control Protocol", STD 7, RFC
4005 793, September 1981.
4007 [TERMS] Bradner, S., "Key words for use in RFCs to Indicate
4008 Requirement Levels", BCP 14, RFC 2119, March 1997.
4010 [TLS] Dierks, T., Allen, C., Treese, W., Karlton, P., Freier, A.
4011 and P. Kocher, "The TLS Protocol Version 1.0", RFC 2246,
4014 [UCS2] International Organization for Standardization,
4015 "Information Technology - Universal Multiple-octet coded
4016 Character Set (UCS) - Amendment 2: UCS Transformation
4017 Format 8 (UTF-8)", ISO Standard 10646-1 Addendum 2,
4020 [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO
4021 10646", STD 63, RFC 3629, November 2003.
4023 [X509] Housley, R., Polk, W., Ford, W. and D. Solo, "Internet
4024 X.509 Public Key Infrastructure Certificate and
4025 Certificate Revocation List (CRL) Profile", RFC 3280,
4031 Saint-Andre (ed.) Expires September 17, 2004 [Page 72]
4033 Internet-Draft XMPP Core March 2004
4036 [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. and E. Maler,
4037 "Extensible Markup Language (XML) 1.0 (2nd ed)", W3C
4038 REC-xml, October 2000, <http://www.w3.org/TR/REC-xml>.
4041 Bray, T., Hollander, D. and A. Layman, "Namespaces in
4042 XML", W3C REC-xml-names, January 1999, <http://www.w3.org/
4045 Informative References
4047 [ACAP] Newman, C. and J. Myers, "ACAP -- Application
4048 Configuration Access Protocol", RFC 2244, November 1997.
4050 [DNSSEC] Eastlake, D., "Domain Name System Security Extensions",
4051 RFC 2535, March 1999.
4053 [HTTP] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
4054 Masinter, L., Leach, P. and T. Berners-Lee, "Hypertext
4055 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
4057 [IMAP] Crispin, M., "Internet Message Access Protocol - Version
4058 4rev1", RFC 2060, December 1996.
4060 [IRC] Oikarinen, J. and D. Reed, "Internet Relay Chat Protocol",
4063 [JSF] Jabber Software Foundation, "Jabber Software Foundation",
4064 <http://www.jabber.org/>.
4066 [POP3] Myers, J. and M. Rose, "Post Office Protocol - Version 3",
4067 STD 53, RFC 1939, May 1996.
4069 [RANDOM] Eastlake, D., Crocker, S. and J. Schiller, "Randomness
4070 Recommendations for Security", RFC 1750, December 1994.
4072 [SIMPLE] SIMPLE Working Group, "SIMPLE WG", <http://www.ietf.org/
4073 html.charters/simple-charter.html>.
4075 [SMTP] Klensin, J., "Simple Mail Transfer Protocol", RFC 2821,
4078 [URI] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform
4079 Resource Identifiers (URI): Generic Syntax", RFC 2396,
4083 Newman, C., "Using TLS with IMAP, POP3 and ACAP", RFC
4087 Saint-Andre (ed.) Expires September 17, 2004 [Page 73]
4089 Internet-Draft XMPP Core March 2004
4094 [XML-REG] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
4097 [XMPP-IM] Saint-Andre, P., "Extensible Messaging and Presence
4098 Protocol (XMPP): Instant Messaging and Presence",
4099 draft-ietf-xmpp-im-21 (work in progress), January 2004.
4105 Jabber Software Foundation
4107 EMail: stpeter@jabber.org
4109 Appendix A. Nodeprep
4113 This appendix defines the "Nodeprep" profile of [STRINGPREP]. As
4114 such, it specifies processing rules that will enable users to enter
4115 internationalized node identifiers in the Extensible Messaging and
4116 Presence Protocol (XMPP) and have the highest chance of getting the
4117 content of the strings correct. (An XMPP node identifier is the
4118 optional portion of an XMPP address that precedes a domain identifier
4119 and the '@' separator; it is often but not exclusively associated
4120 with an instant messaging username.) These processing rules are
4121 intended only for XMPP node identifiers and are not intended for
4122 arbitrary text or any other aspect of an XMPP address.
4124 This profile defines the following, as required by [STRINGPREP]:
4126 o The intended applicability of the profile: internationalized node
4127 identifiers within XMPP
4129 o The character repertoire that is the input and output to
4130 stringprep: Unicode 3.2, specified in Section 2 of this Appendix
4132 o The mappings used: specified in Section 3
4134 o The Unicode normalization used: specified in Section 4
4136 o The characters that are prohibited as output: specified in Section
4139 o Bidirectional character handling: specified in Section 6
4143 Saint-Andre (ed.) Expires September 17, 2004 [Page 74]
4145 Internet-Draft XMPP Core March 2004
4148 A.2 Character Repertoire
4150 This profile uses Unicode 3.2 with the list of unassigned code points
4151 being Table A.1, both defined in Appendix A of [STRINGPREP].
4155 This profile specifies mapping using the following tables from
4165 This profile specifies using Unicode normalization form KC, as
4166 described in [STRINGPREP].
4168 A.5 Prohibited Output
4170 This profile specifies prohibiting use of the following tables from
4195 In addition, the following Unicode characters are also prohibited:
4199 Saint-Andre (ed.) Expires September 17, 2004 [Page 75]
4201 Internet-Draft XMPP Core March 2004
4221 A.6 Bidirectional Characters
4223 This profile specifies checking bidirectional strings as described in
4224 Section 6 of [STRINGPREP].
4226 Appendix B. Resourceprep
4230 This appendix defines the "Resourceprep" profile of [STRINGPREP]. As
4231 such, it specifies processing rules that will enable users to enter
4232 internationalized resource identifiers in the Extensible Messaging
4233 and Presence Protocol (XMPP) and have the highest chance of getting
4234 the content of the strings correct. (An XMPP resource identifier is
4235 the optional portion of an XMPP address that follows a domain
4236 identifier and the '/' separator; it is often but not exclusively
4237 associated with an instant messaging session name.) These processing
4238 rules are intended only for XMPP resource identifiers and are not
4239 intended for arbitrary text or any other aspect of an XMPP address.
4241 This profile defines the following, as required by [STRINGPREP]:
4243 o The intended applicability of the profile: internationalized
4244 resource identifiers within XMPP
4246 o The character repertoire that is the input and output to
4247 stringprep: Unicode 3.2, specified in Section 2 of this Appendix
4249 o The mappings used: specified in Section 3
4251 o The Unicode normalization used: specified in Section 4
4255 Saint-Andre (ed.) Expires September 17, 2004 [Page 76]
4257 Internet-Draft XMPP Core March 2004
4260 o The characters that are prohibited as output: specified in Section
4263 o Bidirectional character handling: specified in Section 6
4266 B.2 Character Repertoire
4268 This profile uses Unicode 3.2 with the list of unassigned code points
4269 being Table A.1, both defined in Appendix A of [STRINGPREP].
4273 This profile specifies mapping using the following tables from
4281 This profile specifies using Unicode normalization form KC, as
4282 described in [STRINGPREP].
4284 B.5 Prohibited Output
4286 This profile specifies prohibiting use of the following tables from
4311 Saint-Andre (ed.) Expires September 17, 2004 [Page 77]
4313 Internet-Draft XMPP Core March 2004
4319 B.6 Bidirectional Characters
4321 This profile specifies checking bidirectional strings as described in
4322 Section 6 of [STRINGPREP].
4324 Appendix C. XML Schemas
4326 The following XML schemas are descriptive, not normative. For
4327 schemas defining the 'jabber:client' and 'jabber:server' namespaces,
4330 C.1 Streams namespace
4332 <?xml version='1.0' encoding='UTF-8'?>
4335 xmlns:xs='http://www.w3.org/2001/XMLSchema'
4336 targetNamespace='http://etherx.jabber.org/streams'
4337 xmlns='http://etherx.jabber.org/streams'
4338 elementFormDefault='unqualified'>
4340 <xs:element name='stream'>
4342 <xs:sequence xmlns:client='jabber:client'
4343 xmlns:server='jabber:server'
4344 xmlns:db='jabber:server:dialback'>
4345 <xs:element ref='features' minOccurs='0' maxOccurs='1'/>
4346 <xs:any namespace='urn:ietf:params:xml:ns:xmpp-tls'
4348 maxOccurs='unbounded'/>
4349 <xs:any namespace='urn:ietf:params:xml:ns:xmpp-sasl'
4351 maxOccurs='unbounded'/>
4352 <xs:choice minOccurs='0' maxOccurs='1'>
4353 <xs:choice minOccurs='0' maxOccurs='unbounded'>
4354 <xs:element ref='client:message'/>
4355 <xs:element ref='client:presence'/>
4356 <xs:element ref='client:iq'/>
4358 <xs:choice minOccurs='0' maxOccurs='unbounded'>
4359 <xs:element ref='server:message'/>
4360 <xs:element ref='server:presence'/>
4361 <xs:element ref='server:iq'/>
4362 <xs:element ref='db:result'/>
4363 <xs:element ref='db:verify'/>
4367 Saint-Andre (ed.) Expires September 17, 2004 [Page 78]
4369 Internet-Draft XMPP Core March 2004
4374 <xs:element ref='error' minOccurs='0' maxOccurs='1'/>
4376 <xs:attribute name='from' type='xs:string' use='optional'/>
4377 <xs:attribute name='id' type='xs:NMTOKEN' use='optional'/>
4378 <xs:attribute name='to' type='xs:string' use='optional'/>
4379 <xs:attribute name='version' type='xs:decimal' use='optional'/>
4380 <xs:attribute ref='xml:lang' use='optional'/>
4384 <xs:element name='features'>
4386 <xs:all xmlns:tls='urn:ietf:params:xml:ns:xmpp-tls'
4387 xmlns:sasl='urn:ietf:params:xml:ns:xmpp-sasl'
4388 xmlns:bind='urn:ietf:params:xml:ns:xmpp-bind'
4389 xmlns:sess='urn:ietf:params:xml:ns:xmpp-session'>
4390 <xs:element ref='tls:starttls' minOccurs='0'/>
4391 <xs:element ref='sasl:mechanisms' minOccurs='0'/>
4392 <xs:element ref='bind:bind' minOccurs='0'/>
4393 <xs:element ref='sess:session' minOccurs='0'/>
4398 <xs:element name='error'>
4400 <xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-streams'>
4401 <xs:group ref='err:errorGroup'/>
4402 <xs:element ref='err:text'
4412 C.2 Stream error namespace
4414 <?xml version='1.0' encoding='UTF-8'?>
4417 xmlns:xs='http://www.w3.org/2001/XMLSchema'
4418 targetNamespace='urn:ietf:params:xml:ns:xmpp-streams'
4419 xmlns='urn:ietf:params:xml:ns:xmpp-streams'
4423 Saint-Andre (ed.) Expires September 17, 2004 [Page 79]
4425 Internet-Draft XMPP Core March 2004
4428 elementFormDefault='qualified'>
4430 <xs:element name='bad-format' type='empty'/>
4431 <xs:element name='bad-namespace-prefix' type='empty'/>
4432 <xs:element name='conflict' type='empty'/>
4433 <xs:element name='connection-timeout' type='empty'/>
4434 <xs:element name='host-gone' type='empty'/>
4435 <xs:element name='host-unknown' type='empty'/>
4436 <xs:element name='improper-addressing' type='empty'/>
4437 <xs:element name='internal-server-error' type='empty'/>
4438 <xs:element name='invalid-from' type='empty'/>
4439 <xs:element name='invalid-id' type='empty'/>
4440 <xs:element name='invalid-namespace' type='empty'/>
4441 <xs:element name='invalid-xml' type='empty'/>
4442 <xs:element name='not-authorized' type='empty'/>
4443 <xs:element name='policy-violation' type='empty'/>
4444 <xs:element name='remote-connection-failed' type='empty'/>
4445 <xs:element name='resource-constraint' type='empty'/>
4446 <xs:element name='restricted-xml' type='empty'/>
4447 <xs:element name='see-other-host' type='xs:string'/>
4448 <xs:element name='system-shutdown' type='empty'/>
4449 <xs:element name='undefined-condition' type='empty'/>
4450 <xs:element name='unsupported-encoding' type='empty'/>
4451 <xs:element name='unsupported-stanza-type' type='empty'/>
4452 <xs:element name='unsupported-version' type='empty'/>
4453 <xs:element name='xml-not-well-formed' type='empty'/>
4455 <xs:group name='errorGroup'>
4457 <xs:element ref='bad-format'/>
4458 <xs:element ref='bad-namespace-prefix'/>
4459 <xs:element ref='conflict'/>
4460 <xs:element ref='connection-timeout'/>
4461 <xs:element ref='host-gone'/>
4462 <xs:element ref='host-unknown'/>
4463 <xs:element ref='improper-addressing'/>
4464 <xs:element ref='internal-server-error'/>
4465 <xs:element ref='invalid-from'/>
4466 <xs:element ref='invalid-id'/>
4467 <xs:element ref='invalid-namespace'/>
4468 <xs:element ref='invalid-xml'/>
4469 <xs:element ref='not-authorized'/>
4470 <xs:element ref='policy-violation'/>
4471 <xs:element ref='remote-connection-failed'/>
4472 <xs:element ref='resource-constraint'/>
4473 <xs:element ref='restricted-xml'/>
4474 <xs:element ref='see-other-host'/>
4475 <xs:element ref='system-shutdown'/>
4479 Saint-Andre (ed.) Expires September 17, 2004 [Page 80]
4481 Internet-Draft XMPP Core March 2004
4484 <xs:element ref='undefined-condition'/>
4485 <xs:element ref='unsupported-encoding'/>
4486 <xs:element ref='unsupported-stanza-type'/>
4487 <xs:element ref='unsupported-version'/>
4488 <xs:element ref='xml-not-well-formed'/>
4492 <xs:element name='text'>
4495 <xs:extension base='xs:string'>
4496 <xs:attribute ref='xml:lang' use='optional'/>
4502 <xs:simpleType name='empty'>
4503 <xs:restriction base='xs:string'>
4504 <xs:enumeration value=''/>
4513 <?xml version='1.0' encoding='UTF-8'?>
4516 xmlns:xs='http://www.w3.org/2001/XMLSchema'
4517 targetNamespace='urn:ietf:params:xml:ns:xmpp-tls'
4518 xmlns='urn:ietf:params:xml:ns:xmpp-tls'
4519 elementFormDefault='qualified'>
4521 <xs:element name='starttls'>
4535 Saint-Andre (ed.) Expires September 17, 2004 [Page 81]
4537 Internet-Draft XMPP Core March 2004
4540 <xs:element name='proceed' type='empty'/>
4541 <xs:element name='failure' type='empty'/>
4543 <xs:simpleType name='empty'>
4544 <xs:restriction base='xs:string'>
4545 <xs:enumeration value=''/>
4554 <?xml version='1.0' encoding='UTF-8'?>
4557 xmlns:xs='http://www.w3.org/2001/XMLSchema'
4558 targetNamespace='urn:ietf:params:xml:ns:xmpp-sasl'
4559 xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
4560 elementFormDefault='qualified'>
4562 <xs:element name='mechanisms'>
4565 <xs:element name='mechanism'
4566 maxOccurs='unbounded'
4572 <xs:element name='auth'>
4575 <xs:extension base='empty'>
4576 <xs:attribute name='mechanism'
4584 <xs:element name='challenge' type='xs:string'/>
4585 <xs:element name='response' type='xs:string'/>
4586 <xs:element name='abort' type='empty'/>
4587 <xs:element name='success' type='empty'/>
4591 Saint-Andre (ed.) Expires September 17, 2004 [Page 82]
4593 Internet-Draft XMPP Core March 2004
4596 <xs:element name='failure'>
4598 <xs:choice minOccurs='0'>
4599 <xs:element name='aborted' type='empty'/>
4600 <xs:element name='incorrect-encoding' type='empty'/>
4601 <xs:element name='invalid-authzid' type='empty'/>
4602 <xs:element name='invalid-mechanism' type='empty'/>
4603 <xs:element name='mechanism-too-weak' type='empty'/>
4604 <xs:element name='not-authorized' type='empty'/>
4605 <xs:element name='temporary-auth-failure' type='empty'/>
4610 <xs:simpleType name='empty'>
4611 <xs:restriction base='xs:string'>
4612 <xs:enumeration value=''/>
4619 C.5 Resource binding namespace
4621 <?xml version='1.0' encoding='UTF-8'?>
4624 xmlns:xs='http://www.w3.org/2001/XMLSchema'
4625 targetNamespace='urn:ietf:params:xml:ns:xmpp-bind'
4626 xmlns='urn:ietf:params:xml:ns:xmpp-bind'
4627 elementFormDefault='qualified'>
4629 <xs:element name='bind'>
4631 <xs:choice minOccurs='0' maxOccurs='1'>
4632 <xs:element name='resource' type='xs:string'/>
4633 <xs:element name='jid' type='xs:string'/>
4641 C.6 Dialback namespace
4643 <?xml version='1.0' encoding='UTF-8'?>
4647 Saint-Andre (ed.) Expires September 17, 2004 [Page 83]
4649 Internet-Draft XMPP Core March 2004
4653 xmlns:xs='http://www.w3.org/2001/XMLSchema'
4654 targetNamespace='jabber:server:dialback'
4655 xmlns='jabber:server:dialback'
4656 elementFormDefault='qualified'>
4658 <xs:element name='result'>
4661 <xs:extension base='xs:NMTOKEN'>
4662 <xs:attribute name='from' type='xs:string' use='required'/>
4663 <xs:attribute name='to' type='xs:string' use='required'/>
4664 <xs:attribute name='type' use='optional'>
4666 <xs:restriction base='xs:NCName'>
4667 <xs:enumeration value='invalid'/>
4668 <xs:enumeration value='valid'/>
4677 <xs:element name='verify'>
4680 <xs:extension base='xs:NMTOKEN'>
4681 <xs:attribute name='from' type='xs:string' use='required'/>
4682 <xs:attribute name='id' type='xs:NMTOKEN' use='required'/>
4683 <xs:attribute name='to' type='xs:string' use='required'/>
4684 <xs:attribute name='type' use='optional'>
4686 <xs:restriction base='xs:NCName'>
4687 <xs:enumeration value='invalid'/>
4688 <xs:enumeration value='valid'/>
4703 Saint-Andre (ed.) Expires September 17, 2004 [Page 84]
4705 Internet-Draft XMPP Core March 2004
4708 C.7 Stanza error namespace
4710 <?xml version='1.0' encoding='UTF-8'?>
4713 xmlns:xs='http://www.w3.org/2001/XMLSchema'
4714 targetNamespace='urn:ietf:params:xml:ns:xmpp-stanzas'
4715 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'
4716 elementFormDefault='qualified'>
4718 <xs:element name='bad-request' type='empty'/>
4719 <xs:element name='conflict' type='empty'/>
4720 <xs:element name='feature-not-implemented' type='empty'/>
4721 <xs:element name='forbidden' type='empty'/>
4722 <xs:element name='gone' type='xs:string'/>
4723 <xs:element name='internal-server-error' type='empty'/>
4724 <xs:element name='item-not-found' type='empty'/>
4725 <xs:element name='jid-malformed' type='empty'/>
4726 <xs:element name='not-acceptable' type='empty'/>
4727 <xs:element name='not-allowed' type='empty'/>
4728 <xs:element name='payment-required' type='empty'/>
4729 <xs:element name='recipient-unavailable' type='empty'/>
4730 <xs:element name='redirect' type='xs:string'/>
4731 <xs:element name='registration-required' type='empty'/>
4732 <xs:element name='remote-server-not-found' type='empty'/>
4733 <xs:element name='remote-server-timeout' type='empty'/>
4734 <xs:element name='resource-constraint' type='empty'/>
4735 <xs:element name='service-unavailable' type='empty'/>
4736 <xs:element name='subscription-required' type='empty'/>
4737 <xs:element name='undefined-condition' type='empty'/>
4738 <xs:element name='unexpected-request' type='empty'/>
4740 <xs:element name='text' type='xs:string'>
4742 <xs:attribute ref='xml:lang' use='optional'/>
4746 <xs:simpleType name='empty'>
4747 <xs:restriction base='xs:string'>
4748 <xs:enumeration value=''/>
4759 Saint-Andre (ed.) Expires September 17, 2004 [Page 85]
4761 Internet-Draft XMPP Core March 2004
4764 Appendix D. Differences Between Core Jabber Protocols and XMPP
4766 This section is non-normative.
4768 XMPP has been adapted from the protocols originally developed in the
4769 Jabber open-source community, which can be thought of as "XMPP 0.9".
4770 Because there exists a large installed base of Jabber implementations
4771 and deployments, it may be helpful to specify the key differences
4772 between the relevant Jabber protocols and XMPP in order to expedite
4773 and encourage upgrades of those implementations and deployments to
4774 XMPP. This section summarizes the core differences, while the
4775 corresponding section of [XMPP-IM] summarizes the differences that
4776 relate specifically to instant messaging and presence applications.
4778 D.1 Channel Encryption
4780 It was common practice in the Jabber community to use SSL for channel
4781 encryption on ports other than 5222 and 5269 (the convention is to
4782 use ports 5223 and 5270). XMPP uses TLS over the IANA-registered
4783 ports for channel encryption, as defined under Use of TLS (Section 5)
4788 The client-server authentication protocol developed in the Jabber
4789 community used a basic IQ interaction qualified by the
4790 'jabber:iq:auth' namespace (documentation of this protocol is
4791 contained in "JEP-0078: Non-SASL Authentication", published by the
4792 Jabber Software Foundation [JSF]). XMPP uses SASL for
4793 authentication, as defined under Use of SASL (Section 6) herein.
4795 The Jabber community did not develop an authentication protocol for
4796 server-to-server communications, only the Server Dialback (Section 8)
4797 protocol to prevent server spoofing. XMPP supersedes Server Dialback
4798 with a true server-to-server authentication protocol, as defined
4799 under Use of SASL (Section 6) herein.
4801 D.3 Resource Binding
4803 Resource binding in the Jabber community was handled via the
4804 'jabber:iq:auth' namespace (which was also used for client
4805 authentication with a server). XMPP defines a dedicated namespace
4806 for resource binding as well as the ability for a server to generate
4807 a resource identifier on behalf of a client, as defined under
4808 Resource Binding (Section 7).
4815 Saint-Andre (ed.) Expires September 17, 2004 [Page 86]
4817 Internet-Draft XMPP Core March 2004
4820 JID processing was somewhat loosely defined by the Jabber community
4821 (documentation of forbidden characters and case handling is contained
4822 in "JEP-0029: Definition of Jabber Identifiers", published by the
4823 Jabber Software Foundation [JSF]). XMPP specifies the use of
4824 [NAMEPREP] for domain identifiers and supplements Nameprep with two
4825 additional [STRINGPREP] profiles for JID processing: Nodeprep
4826 (Appendix A) for node identifiers and Resourceprep (Appendix B) for
4827 resource identifiers.
4831 Stream-related errors were handled in the Jabber community via XML
4832 character data text in a <stream:error/> element. In XMPP,
4833 stream-related errors are handled via an extensible mechanism defined
4834 under Stream Errors (Section 4.7) herein.
4836 Stanza-related errors were handled in the Jabber community via
4837 HTTP-style error codes. In XMPP, stanza-related errors are handled
4838 via an extensible mechanism defined under Stanza Errors (Section 9.3)
4839 herein. (Documentation of a mapping between Jabber and XMPP error
4840 handling mechanisms is contained in "JEP-0086: Error Condition
4841 Mappings", published by the Jabber Software Foundation [JSF].)
4843 D.6 Internationalization
4845 Although use of UTF-8 has always been standard practice within the
4846 Jabber community, the community did not define mechanisms for
4847 specifying the language of human-readable text provided in XML
4848 character data. XMPP specifies the use of the 'xml:lang' attribute
4849 in such contexts, as defined under Stream Attributes (Section 4.4)
4850 and xml:lang (Section 9.1.5) herein.
4852 D.7 Stream Version Attribute
4854 The Jabber community did not include a 'version' attribute in stream
4855 headers. XMPP specifies inclusion of that attribute as a way to
4856 signal support for the stream features (authentication, encryption,
4857 etc.) defined under Version Support (Section 4.4.1) herein.
4871 Saint-Andre (ed.) Expires September 17, 2004 [Page 87]
4873 Internet-Draft XMPP Core March 2004
4876 Intellectual Property Statement
4878 The IETF takes no position regarding the validity or scope of any
4879 intellectual property or other rights that might be claimed to
4880 pertain to the implementation or use of the technology described in
4881 this document or the extent to which any license under such rights
4882 might or might not be available; neither does it represent that it
4883 has made any effort to identify any such rights. Information on the
4884 IETF's procedures with respect to rights in standards-track and
4885 standards-related documentation can be found in BCP-11. Copies of
4886 claims of rights made available for publication and any assurances of
4887 licenses to be made available, or the result of an attempt made to
4888 obtain a general license or permission for the use of such
4889 proprietary rights by implementors or users of this specification can
4890 be obtained from the IETF Secretariat.
4892 The IETF invites any interested party to bring to its attention any
4893 copyrights, patents or patent applications, or other proprietary
4894 rights which may cover technology that may be required to practice
4895 this standard. Please address the information to the IETF Executive
4899 Full Copyright Statement
4901 Copyright (C) The Internet Society (2004). All Rights Reserved.
4903 This document and translations of it may be copied and furnished to
4904 others, and derivative works that comment on or otherwise explain it
4905 or assist in its implementation may be prepared, copied, published
4906 and distributed, in whole or in part, without restriction of any
4907 kind, provided that the above copyright notice and this paragraph are
4908 included on all such copies and derivative works. However, this
4909 document itself may not be modified in any way, such as by removing
4910 the copyright notice or references to the Internet Society or other
4911 Internet organizations, except as needed for the purpose of
4912 developing Internet standards in which case the procedures for
4913 copyrights defined in the Internet Standards process must be
4914 followed, or as required to translate it into languages other than
4917 The limited permissions granted above are perpetual and will not be
4918 revoked by the Internet Society or its successors or assignees.
4920 This document and the information contained herein is provided on an
4921 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
4922 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
4923 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
4927 Saint-Andre (ed.) Expires September 17, 2004 [Page 88]
4929 Internet-Draft XMPP Core March 2004
4932 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
4933 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
4938 Funding for the RFC Editor function is currently provided by the
4983 Saint-Andre (ed.) Expires September 17, 2004 [Page 89]