3923
PROPOSED STANDARD

End-to-End Signing and Object Encryption for the Extensible Messaging and Presence Protocol (XMPP)

Authors: P. Saint-Andre
Date: October 2004
Area: app
Working Group: xmpp
Stream: IETF

Abstract

This memo defines methods of end-to-end signing and object encryption for the Extensible Messaging and Presence Protocol (XMPP). [STANDARDS-TRACK]

RFC 3923: End-to-End Signing and Object Encryption for the Extensible Messaging and Presence Protocol (XMPP) [RFC Home] [TEXT|PDF|HTML] [Tracker] [IPR] [Errata] [Info page]

PROPOSED STANDARD
Errata Exist
Network Working Group                                     P. Saint-Andre
Request for Comments: 3923                    Jabber Software Foundation
Category: Standards Track                                   October 2004


           <span class="h1">End-to-End Signing and Object Encryption for the</span>
           <span class="h1">Extensible Messaging and Presence Protocol (XMPP)</span>

Status of this Memo

   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.  Please refer to the current edition of the "Internet
   Official Protocol Standards" (STD 1) for the standardization state
   and status of this protocol.  Distribution of this memo is unlimited.

Copyright Notice

   Copyright (C) The Internet Society (2004).

Abstract

   This memo defines methods of end-to-end signing and object encryption
   for the Extensible Messaging and Presence Protocol (XMPP).

Table of Contents

   <a href="#section-1">1</a>.   Introduction . . . . . . . . . . . . . . . . . . . . . . . .   <a href="#page-2">2</a>
   <a href="#section-2">2</a>.   Requirements . . . . . . . . . . . . . . . . . . . . . . . .   <a href="#page-2">2</a>
   <a href="#section-3">3</a>.   Securing Messages  . . . . . . . . . . . . . . . . . . . . .   <a href="#page-4">4</a>
   <a href="#section-4">4</a>.   Securing Presence  . . . . . . . . . . . . . . . . . . . . .   <a href="#page-9">9</a>
   <a href="#section-5">5</a>.   Securing Arbitrary XMPP Data . . . . . . . . . . . . . . . .  <a href="#page-13">13</a>
   <a href="#section-6">6</a>.   Rules for S/MIME Generation and Handling . . . . . . . . . .  <a href="#page-15">15</a>
   <a href="#section-7">7</a>.   Recipient Error Handling . . . . . . . . . . . . . . . . . .  <a href="#page-18">18</a>
   <a href="#section-8">8</a>.   Secure Communications Through a Gateway  . . . . . . . . . .  <a href="#page-20">20</a>
   <a href="#section-9">9</a>.   urn:ietf:params:xml:xmpp-e2e Namespace . . . . . . . . . . .  <a href="#page-21">21</a>
   <a href="#section-10">10</a>.  application/xmpp+xml Media Type  . . . . . . . . . . . . . .  <a href="#page-21">21</a>
   <a href="#section-11">11</a>.  Security Considerations  . . . . . . . . . . . . . . . . . .  <a href="#page-22">22</a>
   <a href="#section-12">12</a>.  IANA Considerations  . . . . . . . . . . . . . . . . . . . .  <a href="#page-22">22</a>
   <a href="#section-13">13</a>.  References . . . . . . . . . . . . . . . . . . . . . . . . .  <a href="#page-23">23</a>
   <a href="#appendix-A">A</a>.   Schema for urn:ietf:params:xml:ns:xmpp-e2e . . . . . . . . .  <a href="#page-26">26</a>
   Author's Address. . . . . . . . . . . . . . . . . . . . . . . . .  <a href="#page-26">26</a>
   Full Copyright Statement. . . . . . . . . . . . . . . . . . . . .  <a href="#page-27">27</a>








<span class="grey">Saint-Andre                 Standards Track                     [Page 1]</span>

<span id="page-2" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>.  Introduction</span>

   This memo defines methods of end-to-end signing and object encryption
   for the Extensible Messaging and Presence Protocol (XMPP).  (For
   information about XMPP, see [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>] and [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP) Instant Messaging and Presence"">XMPP-IM</a>].)  The method
   specified herein enables a sender to sign and/or encrypt an instant
   message sent to a specific recipient, sign and/or encrypt presence
   information that is directed to a specific user, and sign and/or
   encrypt any arbitrary XMPP stanza directed to a specific user.  This
   memo thereby helps the XMPP specifications meet the requirements
   specified in [<a href="#ref-IMP-REQS" title=""Instant Messaging/Presence Protocol Requirements"">IMP-REQS</a>].

<span class="h3"><a class="selflink" id="section-1.1" href="#section-1.1">1.1</a>.  Terminology</span>

   This document inherits terminology defined in [<a href="#ref-CMS" title=""Cryptographic Message Syntax (CMS)"">CMS</a>], [<a href="#ref-IMP-MODEL" title=""A Model for Presence and Instant Messaging"">IMP-MODEL</a>],
   [<a href="#ref-SMIME" title=""Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1 Message Specification"">SMIME</a>], and [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>].

   The capitalized key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
   "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
   "OPTIONAL" in this document are to be interpreted as described in <a href="https://www.rfc-editor.org/bcp/bcp14">BCP</a>
   <a href="https://www.rfc-editor.org/bcp/bcp14">14</a>, <a href="./rfc2119">RFC 2119</a> [<a href="#ref-TERMS" title=""Key words for use in RFCs to Indicate Requirement Levels"">TERMS</a>].

<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>.  Requirements</span>

   For the purposes of this memo, we stipulate the following
   requirements:

   1.  The method defined MUST address signing and encryption
       requirements for minimal instant messaging and presence, as those
       are defined in [<a href="#ref-IMP-REQS" title=""Instant Messaging/Presence Protocol Requirements"">IMP-REQS</a>].  In particular, the method MUST
       address the following requirements, which are copied here
       verbatim from [<a href="#ref-IMP-REQS" title=""Instant Messaging/Presence Protocol Requirements"">IMP-REQS</a>]:

       *  The protocol MUST provide means to ensure confidence that a
          received message (NOTIFICATION or INSTANT MESSAGE) has not
          been corrupted or tampered with.  (<a href="#section-2.5.1">Section 2.5.1</a>)

       *  The protocol MUST provide means to ensure confidence that a
          received message (NOTIFICATION or INSTANT MESSAGE) has not
          been recorded and played back by an adversary.  (<a href="#section-2.5.2">Section</a>
          <a href="#section-2.5.2">2.5.2</a>)

       *  The protocol MUST provide means to ensure that a sent message
          (NOTIFICATION or INSTANT MESSAGE) is only readable by ENTITIES
          that the sender allows.  (<a href="#section-2.5.3">Section 2.5.3</a>)






<span class="grey">Saint-Andre                 Standards Track                     [Page 2]</span>

<span id="page-3" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


       *  The protocol MUST allow any client to use the means to ensure
          non-corruption, non-playback, and privacy, but the protocol
          MUST NOT require that all clients use these means at all
          times.  (<a href="#section-2.5.4">Section 2.5.4</a>)

       *  When A establishes a SUBSCRIPTION to B's PRESENCE INFORMATION,
          the protocol MUST provide A means of verifying the accurate
          receipt of the content B chooses to disclose to A.  (<a href="#section-5.1.4">Section</a>
          <a href="#section-5.1.4">5.1.4</a>)

       *  The protocol MUST provide A means of verifying that the
          presence information is accurate, as sent by B.  (<a href="#section-5.3.1">Section</a>
          <a href="#section-5.3.1">5.3.1</a>)

       *  The protocol MUST provide A means of ensuring that no other
          PRINCIPAL C can see the content of M.  (<a href="#section-5.4.6">Section 5.4.6</a>)

       *  The protocol MUST provide A means of ensuring that no other
          PRINCIPAL C can tamper with M, and B means to verify that no
          tampering has occurred.  (<a href="#section-5.4.7">Section 5.4.7</a>)

   2.  The method defined MUST enable interoperability with non-XMPP
       messaging systems that support the Common Presence and Instant
       Messaging (CPIM) specifications published by the Instant
       Messaging and Presence (IMPP) Working Group.  Two corollaries of
       this requirement are:

       *  Prior to signing and/or encrypting, the format of an instant
          message MUST conform to the CPIM Message Format defined in
          [<a href="#ref-MSGFMT" title=""Common Presence and Instant Messaging (CPIM): Message Format"">MSGFMT</a>].

       *  Prior to signing and/or encrypting, the format of presence
          information MUST conform to the CPP Presence Information Data
          Format defined in [<a href="#ref-PIDF" title=""Presence Information Data Format (PIDF)"">PIDF</a>].

   3.  The method MUST follow the required procedures (including the
       specific algorithms) defined in [<a href="#ref-CPIM" title=""Common Profile for Instant Messaging (CPIM)"">CPIM</a>] and [<a href="#ref-CPP" title=""Common Profile for Presence (CPP)"">CPP</a>].  In particular,
       these documents specify:

       *  Signing MUST use [<a href="#ref-SMIME" title=""Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1 Message Specification"">SMIME</a>] signatures with [<a href="#ref-CMS" title=""Cryptographic Message Syntax (CMS)"">CMS</a>] SignedData.

       *  Encryption MUST use [<a href="#ref-SMIME" title=""Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1 Message Specification"">SMIME</a>] encryption with [<a href="#ref-CMS" title=""Cryptographic Message Syntax (CMS)"">CMS</a>]
          EnvelopeData.

   4.  In order to enable interoperable implementations, sending and
       receiving applications MUST implement the algorithms specified
       under Mandatory-to-Implement Cryptographic Algorithms (<a href="#section-6.10">Section</a>
       <a href="#section-6.10">6.10</a>).



<span class="grey">Saint-Andre                 Standards Track                     [Page 3]</span>

<span id="page-4" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   We further stipulate that the following functionality is out of scope
   for this memo:

   o  Discovery of support for this protocol.  An entity could discover
      whether another entity supports this protocol by (1) attempting to
      send signed or encrypted stanzas and receiving an error stanza
      ("technical" discovery) or a textual message in reply ("social"
      discovery) if the protocol is not supported, or (2) using a
      dedicated service discovery protocol, such as [<a href="#ref-DISCO" title=""Service Discovery"">DISCO</a>] or [<a href="#ref-CAPS" title=""Entity Capabilities"">CAPS</a>].
      However, the definition of a service discovery protocol is out of
      scope for this memo.

   o  Signing or encryption of XMPP groupchat messages, which are
      mentioned in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP) Instant Messaging and Presence"">XMPP-IM</a>] but not defined therein since they are not
      required by [<a href="#ref-IMP-REQS" title=""Instant Messaging/Presence Protocol Requirements"">IMP-REQS</a>]; such messages are best specified in [<a href="#ref-MUC" title=""Multi-User Chat"">MUC</a>].

   o  Signing or encryption of broadcasted presence as described in
      [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP) Instant Messaging and Presence"">XMPP-IM</a>] (the methods defined herein apply to directed presence
      only).

   o  Signing or encryption of communications that occur within the
      context of applications other than instant messaging and presence
      as those are described in [<a href="#ref-IMP-MODEL" title=""A Model for Presence and Instant Messaging"">IMP-MODEL</a>] and [<a href="#ref-IMP-REQS" title=""Instant Messaging/Presence Protocol Requirements"">IMP-REQS</a>].

<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>.  Securing Messages</span>

<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>.  Process for Securing Messages</span>

   In order to sign and/or encrypt a message, a sending agent MUST use
   the following procedure:

   1.  Generate a "Message/CPIM" object as defined in [<a href="#ref-MSGFMT" title=""Common Presence and Instant Messaging (CPIM): Message Format"">MSGFMT</a>].

   2.  Sign and/or encrypt both the headers and content of the
       "Message/CPIM" object as specified in Requirement 3 of <a href="#section-2">Section 2</a>
       above.

   3.  Provide the resulting signed and/or encrypted object within an
       XML CDATA section (see Section 2.7 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (3rd ed)"">XML</a>]) contained in an
       <e2e/> child of a <message/> stanza, where the <e2e/> element is
       qualified by the 'urn:ietf:params:xml:ns:xmpp-e2e' namespace as
       specified more fully in <a href="#section-9">Section 9</a> below.

<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>.  Example of a Signed Message</span>

   The following example illustrates the defined steps for signing a
   message.




<span class="grey">Saint-Andre                 Standards Track                     [Page 4]</span>

<span id="page-5" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   First, the sending agent generates a "Message/CPIM" object in
   accordance with the rules and formats specified in [<a href="#ref-MSGFMT" title=""Common Presence and Instant Messaging (CPIM): Message Format"">MSGFMT</a>].

   Example 1: Sender generates "Message/CPIM" object:

   |   Content-type: Message/CPIM
   |
   |   From: Juliet Capulet <im:juliet@example.com>
   |   To: Romeo Montague <im:romeo@example.net>
   |   DateTime: 2003-12-09T11:45:36.66Z
   |   Subject: Imploring
   |
   |   Content-type: text/plain; charset=utf-8
   |   Content-ID: <1234567890@example.com>
   |
   |   Wherefore art thou, Romeo?

   Once the sending agent has generated the "Message/CPIM" object, the
   sending agent may sign it.  The result is a multipart [<a href="#ref-SMIME" title=""Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1 Message Specification"">SMIME</a>] object
   (see [<a href="#ref-MULTI" title=""Security Multiparts for MIME: Multipart/Signed and Multipart/Encrypted"">MULTI</a>]) that has a Content-Type of "multipart/signed" and
   includes two parts: one whose Content-Type is "Message/CPIM" and
   another whose Content-Type is "application/pkcs7-signature".





























<span class="grey">Saint-Andre                 Standards Track                     [Page 5]</span>

<span id="page-6" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Example 2: Sender generates multipart/signed object:

   |   Content-Type: multipart/signed; boundary=next;
   |                 micalg=sha1;
   |                 protocol=application/pkcs7-signature
   |
   |   --next
   |   Content-type: Message/CPIM
   |
   |   From: Juliet Capulet <im:juliet@example.com>
   |   To: Romeo Montague <im:romeo@example.net>
   |   DateTime: 2003-12-09T23:45:36.66Z
   |   Subject: Imploring
   |
   |   Content-type: text/plain; charset=utf-8
   |   Content-ID: <1234567890@example.com>
   |
   |   Wherefore art thou, Romeo?
   |   --next
   |   Content-Type: application/pkcs7-signature
   |   Content-Disposition: attachment;handling=required;\
   |                                   filename=smime.p7s
   |
   |   [signed body part]
   |
   |   --next--

   The sending agent now wraps the "multipart/signed" object in an XML
   CDATA section, which is contained in an <e2e/> element that is
   included as a child element of the XMPP message stanza and that is
   qualified by the 'urn:ietf:params:xml:ns:xmpp-e2e' namespace.




















<span class="grey">Saint-Andre                 Standards Track                     [Page 6]</span>

<span id="page-7" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Example 3: Sender generates XMPP message stanza:

   |   <message to='[email protected]/orchard' type='chat'>
   |     <e2e xmlns='urn:ietf:params:xml:ns:xmpp-e2e'>
   |   <![CDATA[
   |   Content-Type: multipart/signed; boundary=next;
   |                 micalg=sha1;
   |                 protocol=application/pkcs7-signature
   |
   |   --next
   |   Content-type: Message/CPIM
   |
   |   From: Juliet Capulet <im:[email protected]>
   |   To: Romeo Montague <im:[email protected]>
   |   DateTime: 2003-12-09T23:45:36.66Z
   |   Subject: Imploring
   |
   |   Content-type: text/plain; charset=utf-8
   |   Content-ID: <[email protected]>
   |
   |   Wherefore art thou, Romeo?
   |   --next
   |   Content-Type: application/pkcs7-signature
   |   Content-Disposition: attachment;handling=required;\
   |                                   filename=smime.p7s
   |
   |   [signed body part]
   |
   |   --next--
   |   ]]>
   |     </e2e>
   |   </message>


<span class="h3"><a class="selflink" id="section-3.3" href="#section-3.3">3.3</a>.  Example of an Encrypted Message</span>

   The following example illustrates the defined steps for encrypting a
   message.

   First, the sending agent generates a "Message/CPIM" object in
   accordance with the rules and formats specified in [<a href="#ref-MSGFMT" title=""Common Presence and Instant Messaging (CPIM): Message Format"">MSGFMT</a>].










<span class="grey">Saint-Andre                 Standards Track                     [Page 7]</span>

<span id="page-8" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Example 4: Sender generates "Message/CPIM" object:

   |   Content-type: Message/CPIM
   |
   |   From: Juliet Capulet <im:juliet@example.com>
   |   To: Romeo Montague <im:romeo@example.net>
   |   DateTime: 2003-12-09T11:45:36.66Z
   |   Subject: Imploring
   |
   |   Content-type: text/plain; charset=utf-8
   |   Content-ID: <1234567890@example.com>
   |
   |   Wherefore art thou, Romeo?

   Once the sending agent has generated the "Message/CPIM" object, the
   sending agent may encrypt it.

   Example 5: Sender generates encrypted object:

   |   U2FsdGVkX19okeKTlLxa/1n1FE/upwn1D20GhPWqhDWlexKMUKYJInTWzERP+vcQ
   |   /OxFs40uc9Fx81a5/62p/yPb/UWnuG6SR6o3Ed2zwcusDImyyz125HFERdDUMBC9
   |   Pt6Z4cTGKBmJzZBGyuc3Y+TMBTxqFFUAxeWaoxnZrrl+LP72vwbriYc3KCMxDbQL
   |   Igc1Vzs5/5JecegMieNY24SlNyX9HMFRNFpbI64vLxYEk55A+3IYbZsluCFT31+a
   |   +GeAvJkvH64LRV4mPbUhENTQ2wbAwnOTvbLIaQEQrii78xNEh+MK8Bx7TBTvi4yH
   |   Ddzf9Sim6mtWsXaCAvWSyp0X91d7xRJ4JIgKfPzkxNsWJFCLthQS1p734eDxXVd3
   |   i08lEHzyll6htuEr59ZDAw==

   The sending agent now wraps the encrypted object in an XML CDATA
   section, which is contained in an <e2e/> element that is included as
   a child element of the XMPP message stanza and that is qualified by
   the 'urn:ietf:params:xml:ns:xmpp-e2e' namespace.

   Example 6: Sender generates XMPP message stanza:

   |   <message to='[email protected]/orchard' type='chat'>
   |     <e2e xmlns='urn:ietf:params:xml:ns:xmpp-e2e'>
   |   <![CDATA[
   |   U2FsdGVkX19okeKTlLxa/1n1FE/upwn1D20GhPWqhDWlexKMUKYJInTWzERP+vcQ
   |   /OxFs40uc9Fx81a5/62p/yPb/UWnuG6SR6o3Ed2zwcusDImyyz125HFERdDUMBC9
   |   Pt6Z4cTGKBmJzZBGyuc3Y+TMBTxqFFUAxeWaoxnZrrl+LP72vwbriYc3KCMxDbQL
   |   Igc1Vzs5/5JecegMieNY24SlNyX9HMFRNFpbI64vLxYEk55A+3IYbZsluCFT31+a
   |   +GeAvJkvH64LRV4mPbUhENTQ2wbAwnOTvbLIaQEQrii78xNEh+MK8Bx7TBTvi4yH
   |   Ddzf9Sim6mtWsXaCAvWSyp0X91d7xRJ4JIgKfPzkxNsWJFCLthQS1p734eDxXVd3
   |   i08lEHzyll6htuEr59ZDAw==
   |   ]]>
   |     </e2e>
   |   </message>




<span class="grey">Saint-Andre                 Standards Track                     [Page 8]</span>

<span id="page-9" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>.  Securing Presence</span>

<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>.  Process for Securing Presence Information</span>

   In order to sign and/or encrypt presence information, a sending agent
   MUST use the following procedure:

   1.  Generate an "application/pidf+xml" object as defined in [<a href="#ref-PIDF" title=""Presence Information Data Format (PIDF)"">PIDF</a>].
   2.  Sign and/or encrypt the "application/pidf+xml" object as
       specified in Requirement 3 of <a href="#section-2">Section 2</a> above.
   3.  Provide the resulting signed and/or encrypted object within an
       XML CDATA section (see Section 2.7 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (3rd ed)"">XML</a>]) contained in an
       <e2e/> child of a <presence/> stanza, where the <e2e/> element is
       qualified by the 'urn:ietf:params:xml:ns:xmpp-e2e' namespace. The
       <presence/> stanza MUST include a 'to' attribute, i.e., it must
       be an instance of directed presence as defined in [<a href="#ref-XMPP-IM" title=""Extensible Messaging and Presence Protocol (XMPP) Instant Messaging and Presence"">XMPP-IM</a>].

<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>.  Example of Signed Presence Information</span>

   The following example illustrates the defined steps for signing
   presence information.

   First, the sending agent generates an "application/pidf+xml" object
   in accordance with the rules and formats specified in [<a href="#ref-PIDF" title=""Presence Information Data Format (PIDF)"">PIDF</a>].

   Example 7: Sender generates "application/pidf+xml" object:

   |   <?xml version="1.0" encoding="UTF-8"?>
   |   <presence xmlns="urn:ietf:params:xml:ns:pidf"
   |             xmlns:im="urn:ietf:params:xml:ns:pidf:im"
   |             entity="pres:[email protected]">
   |     <tuple id="hr0zny"
   |       <status>
   |         <basic>open</basic>
   |         <im:im>away</im:im>
   |       </status>
   |       <note xml:lang="en">retired to the chamber</note>
   |       <timestamp>2003-12-09T23:53:11.31</timestamp>
   |     </tuple>
   |   </presence>

   Once the sending agent has generated the "application/pidf+xml"
   object, the sending agent may sign it.  The result is a multipart
   [<a href="#ref-SMIME" title=""Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1 Message Specification"">SMIME</a>] object (see [<a href="#ref-MULTI" title=""Security Multiparts for MIME: Multipart/Signed and Multipart/Encrypted"">MULTI</a>]) that has a Content-Type of
   "multipart/signed" and includes two parts: one whose Content-Type is
   "application/pidf+xml" and another whose Content-Type is
   "application/pkcs7-signature".




<span class="grey">Saint-Andre                 Standards Track                     [Page 9]</span>

<span id="page-10" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Example 8: Sender generates multipart/signed object:

   |   Content-Type: multipart/signed; boundary=next;
   |                 micalg=sha1;
   |                 protocol=application/pkcs7-signature
   |
   |   --next
   |   Content-type: application/pidf+xml
   |   Content-ID: <2345678901@example.com>
   |
   |   <xml version="1.0" encoding="UTF-8"?>
   |   <presence xmlns="urn:ietf:params:xml:ns:pidf"
   |             xmlns:im="urn:ietf:params:xml:ns:pidf:im"
   |             entity="pres:[email protected]">
   |     <tuple id="hr0zny">
   |       <status&gt;
   |         <basic>open</basic>
   |         <im:im>away</im:im>
   |       </status>
   |       <note xml:lang="en">retired to the chamber</note>
   |       <timestamp>2003-12-09T23:53:11.31Z</timestamp>
   |     </tuple>
   |   </presence>
   |   --next
   |   Content-Type: application/pkcs7-signature
   |   Content-Disposition: attachment;handling=required;\
   |                                   filename=smime.p7s
   |
   |   [signed body part]
   |
   |   --next--

   The sending agent now wraps the "multipart/signed" object in an XML
   CDATA section, which is contained in an <e2e/> element that is
   included as a child element of the XMPP message stanza and that is
   qualified by the 'urn:ietf:params:xml:ns:xmpp-e2e' namespace.















<span class="grey">Saint-Andre                 Standards Track                    [Page 10]</span>

<span id="page-11" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Example 9: Sender generates XMPP presence stanza:

   |   <presence to='[email protected]/orchard'>
   |     <e2e xmlns='urn:ietf:params:xml:ns:xmpp-e2e'>
   |   <![CDATA[
   |   Content-Type: multipart/signed; boundary=next;
   |                 micalg=sha1;
   |                 protocol=application/pkcs7-signature
   |
   |   --next
   |   Content-type: application/pidf+xml
   |   Content-ID: <[email protected]>
   |
   |   <xml version="1.0" encoding="UTF-8"?>
   |   <presence xmlns="urn:ietf:params:xml:ns:pidf"
   |             xmlns:im="urn:ietf:params:xml:ns:pidf:im"
   |             entity="pres:[email protected]">
   |     <tuple id="hr0zny">
   |       <status>
   |         <basic>open</basic>
   |         <im:im>away</im:im>
   |       </status>
   |       <note xml:lang="en">retired to the chamber</note>
   |       <timestamp>2003-12-09T23:53:11.31Z</timestamp>
   |     </tuple>
   |   </presence>
   |   --next
   |   Content-Type: application/pkcs7-signature
   |   Content-Disposition: attachment;handling=required;\
   |                                   filename=smime.p7s
   |
   |   [signed body part]
   |
   |   --next--
   |   ]]>
   |     </e2e>
   |   </presence>

<span class="h3"><a class="selflink" id="section-4.3" href="#section-4.3">4.3</a>.  Example of Encrypted Presence Information</span>

   The following example illustrates the defined steps for encrypting
   presence information.

   First, the sending agent generates an "application/pidf+xml" object
   in accordance with the rules and formats specified in [<a href="#ref-PIDF" title=""Presence Information Data Format (PIDF)"">PIDF</a>].






<span class="grey">Saint-Andre                 Standards Track                    [Page 11]</span>

<span id="page-12" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Example 10: Sender generates "application/pidf+xml" object:

   |   <?xml version="1.0" encoding="UTF-8"?>
   |   <presence xmlns="urn:ietf:params:xml:ns:pidf"
   |             xmlns:im="urn:ietf:params:xml:ns:pidf:im"
   |             entity="pres:[email protected]">
   |     <tuple id="hr0zny"
   |       <status>
   |         <basic>open</basic>
   |         <im:im>away</im:im>
   |       </status>
   |       <note xml:lang="en">retired to the chamber</note>
   |       <timestamp>2003-12-09T23:53:11.31</timestamp>
   |     </tuple>
   |   </presence>

   Once the sending agent has generated the "application/pidf+xml"
   object, the sending agent may encrypt it.

   Example 11: Sender generates encrypted object:

   |   U2FsdGVkX18VJPbx5GMdFPTPZrHLC9QGiVP+ziczu6zWZLFQxae6O5PP6iqpr2No
   |   zOvBVMWvYeRAT0zd18hr6qsqKiGl/GZpAAbTvPtaBxeIykxsd1+CX+U+iw0nEGCr
   |   bjiQrk0qUKJ79bNxwRnqdidjhyTpKSbOJC0XZ8CTe7AE9KDM3Q+uk+O3jrqX4byL
   |   GBlKThbzKidxz32ObojPEEwfFiM/yUeqYUP1OcJpUmeQ8lcXhD6tcx+m2MAyYYLP
   |   boKQxpLknxRnbM8T/voedlnFLbbDu69mOlxDPbr1mHZd3hDsyFudb1fb4rI3Kw0K
   |   Nq+3udr2IkysviJDgQo+xGIQUG/5sED/mAaPRlj4f/JtTzvT4EaQTawv69ntXfKV
   |   MCr9KdIMMdjdJzOJkYLoAhNVrcZn5tw8WsJGwuKuhYb/SShy7InzOapPaPAl7/Mm
   |   PHj7zj3NZ6EEIweDOuAwWlIG/dT506tci27+EW7JnXwMPnFMkF+6a7tr/0Y+iiej
   |   woJxUIBqCOgX+U7srHpK2NYtNTZ7UQp2V0yEx1JV8+Y=

   The sending agent now wraps the encrypted object in an XML CDATA
   section, which is contained in an <e2e/> element that is included as
   a child element of the XMPP message stanza and that is qualified by
   the 'urn:ietf:params:xml:ns:xmpp-e2e' namespace.
















<span class="grey">Saint-Andre                 Standards Track                    [Page 12]</span>

<span id="page-13" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Example 12: Sender generates XMPP presence stanza:

   |   <presence to='[email protected]/orchard'>
   |     <e2e xmlns='urn:ietf:params:xml:ns:xmpp-e2e'>
   |   <![CDATA[
   |   U2FsdGVkX18VJPbx5GMdFPTPZrHLC9QGiVP+ziczu6zWZLFQxae6O5PP6iqpr2No
   |   zOvBVMWvYeRAT0zd18hr6qsqKiGl/GZpAAbTvPtaBxeIykxsd1+CX+U+iw0nEGCr
   |   bjiQrk0qUKJ79bNxwRnqdidjhyTpKSbOJC0XZ8CTe7AE9KDM3Q+uk+O3jrqX4byL
   |   GBlKThbzKidxz32ObojPEEwfFiM/yUeqYUP1OcJpUmeQ8lcXhD6tcx+m2MAyYYLP
   |   boKQxpLknxRnbM8T/voedlnFLbbDu69mOlxDPbr1mHZd3hDsyFudb1fb4rI3Kw0K
   |   Nq+3udr2IkysviJDgQo+xGIQUG/5sED/mAaPRlj4f/JtTzvT4EaQTawv69ntXfKV
   |   MCr9KdIMMdjdJzOJkYLoAhNVrcZn5tw8WsJGwuKuhYb/SShy7InzOapPaPAl7/Mm
   |   PHj7zj3NZ6EEIweDOuAwWlIG/dT506tci27+EW7JnXwMPnFMkF+6a7tr/0Y+iiej
   |   woJxUIBqCOgX+U7srHpK2NYtNTZ7UQp2V0yEx1JV8+Y=
   |   ]]>
   |     </e2e>
   |   </presence>

<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>.  Securing Arbitrary XMPP Data</span>

   The foregoing sections of this memo describe how to secure "least
   common denominator" messaging and presence data of the kind that can
   be directly translated into the MSGFMT or PIDF formats.  However,
   XMPP possesses a third base-level stanza type (<iq/>) in addition to
   <message/> and <presence/>, as well as the ability to include
   extended XML data within arbitrary child elements of the three core
   stanza types.  Therefore, it would be desirable to secure such data
   if possible.

   Because [<a href="#ref-MSGFMT" title=""Common Presence and Instant Messaging (CPIM): Message Format"">MSGFMT</a>] specifies the ability to encapsulate any MIME type,
   the approach taken in this memo is to include arbitrary XMPP data in
   an XML media type named "application/xmpp+xml" as specified more
   fully in <a href="#section-10">Section 10</a> below.

   The following examples illustrate the structure of the
   "application/xmpp+xml" MIME type.  (Note: The
   'http://jabber.org/protocol/evil' namespace used in these examples is
   associated with an April Fool's protocol written to be the instant
   messaging equivalent of <a href="./rfc3514">RFC 3514</a>; it is included only as an instance
   of extended information included in an XML stanza and should not be
   taken seriously as a functional XMPP extension.)










<span class="grey">Saint-Andre                 Standards Track                    [Page 13]</span>

<span id="page-14" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Example 13: Message stanza with extended data contained in
   "application/xmpp+xml" MIME type:

   |   <?xml version='1.0' encoding='UTF-8'?>
   |   <xmpp xmlns='jabber:client'>
   |     <message
   |         from='[email protected]/pda'
   |         to='[email protected]/cell'>
   |       <body>
   |         I told him what I thought, and told no more
   |         Than what he found himself was apt and true.
   |       </body>
   |       <evil xmlns='http://jabber.org/protocol/evil'/>
   |     </message>
   |   </xmpp>

   Example 14: Presence stanza with extended data contained in
   "application/xmpp+xml" MIME type:

   |   <?xml version='1.0' encoding='UTF-8'?>
   |   <xmpp xmlns='jabber:client'>
   |     <presence from='[email protected]/pda'>
   |       <show>dnd</show>
   |       <status>Fomenting dissension</status>
   |       <evil xmlns='http://jabber.org/protocol/evil'/>
   |     </presence>
   |   </xmpp>

   Example 15: IQ stanza with extended data contained in "application/
   xmpp+xml" MIME type:

   |   <?xml version='1.0' encoding='UTF-8'?>
   |   <xmpp xmlns='jabber:client'>
   |     <iq type='result'
   |         from='[email protected]/pda'
   |         to='[email protected]/cell'
   |         id='evil1'>
   |       <query xmlns='jabber:iq:version'>
   |         <name>Stabber</name>
   |         <version>666</version>
   |         <os>FiendOS</os>
   |       </query>
   |       <evil xmlns='http://jabber.org/protocol/evil'/>
   |     </iq>
   |   </xmpp>






<span class="grey">Saint-Andre                 Standards Track                    [Page 14]</span>

<span id="page-15" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Just as with the "Message/CPIM" and "application/pidf+xml" objects,
   the "application/xmpp+xml" object would be signed and/or encrypted,
   then encapsulated within an XML CDATA section (see Section 2.7 of
   [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (3rd ed)"">XML</a>]) contained in an <e2e/> child of a <presence/> stanza, where
   the <e2e/> element is qualified by the
   'urn:ietf:params:xml:ns:xmpp-e2e' namespace.

<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>.  Rules for S/MIME Generation and Handling</span>

<span class="h3"><a class="selflink" id="section-6.1" href="#section-6.1">6.1</a>.  Certificate Enrollment</span>

   [<a id="ref-SMIME">SMIME</a>] does not specify how to obtain a certificate from a
   certificate authority, but instead mandates that every sending agent
   must already have a certificate.  The PKIX Working Group has, at the
   time of this writing, produced two separate standards for certificate
   enrollment: [<a href="#ref-CMP" title=""Internet X.509 Public Key Infrastructure Certificate Management Protocols"">CMP</a>] and [<a href="#ref-CMC" title=""Certificate Management Messages over CMS"">CMC</a>].  Which method to use for certificate
   enrollment is outside the scope of this memo.

<span class="h3"><a class="selflink" id="section-6.2" href="#section-6.2">6.2</a>.  Certificate Retrieval</span>

   A receiving agent MUST provide some certificate retrieval mechanism
   in order to gain access to certificates for recipients of digital
   envelopes.  This memo does not address how S/MIME agents handle
   certificates, only what they do after a certificate has been
   validated or rejected.  S/MIME certification issues are covered in
   [<a href="#ref-CERT" title=""Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1 Certificate Handling"">CERT</a>].

   However, at a minimum, for initial S/MIME deployment, a user agent
   SHOULD automatically generate a message to an intended recipient
   requesting that recipient's certificate in a signed return message.
   Receiving and sending agents SHOULD also provide a mechanism to allow
   a user to "store and protect" certificates for correspondents in such
   a way so as to guarantee their later retrieval.

<span class="h3"><a class="selflink" id="section-6.3" href="#section-6.3">6.3</a>.  Certificate Names</span>

   End-entity certificates used by XMPP entities in the context of this
   memo SHOULD contain a valid instant messaging and presence address.
   The address SHOULD be specified as both an 'im:' URI (for instant
   messaging, as defined in [<a href="#ref-CPIM" title=""Common Profile for Instant Messaging (CPIM)"">CPIM</a>]) and a 'pres:' URI (for presence, as
   defined in [<a href="#ref-CPP" title=""Common Profile for Presence (CPP)"">CPP</a>]); each of these URIs SHOULD be specified in a
   separate GeneralName entry of type uniformResourceIdentifier inside
   the subjectAltName (i.e., two separate entries).  Information in the
   subject distinguished name SHOULD be ignored.

   Each URI MUST be of the form <im:address> or <pres:address>, where
   the "address" portion is an XMPP address (also referred to as a
   Jabber Identifier or JID) as defined in [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>], prepended with



<span class="grey">Saint-Andre                 Standards Track                    [Page 15]</span>

<span id="page-16" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   the 'im:' or 'pres:' URI scheme.  The address SHOULD be of the form
   <node@domain> (i.e., a "bare JID"), although any valid JID form MAY
   be used.

   The value of the JID contained in the XMPP 'from' attribute MUST
   match a JID provided in the signer's certificate, with the exception
   that the resource identifier portion of the JID contained in the
   'from' attribute SHOULD be ignored for matching purposes.

   Receiving agents MUST check that the sending JID matches a JID
   provided in the signer's certificate, with the exception that the
   resource identifier portion of the JID contained in the 'from'
   attribute SHOULD be ignored for matching purposes.  A receiving agent
   SHOULD provide some explicit alternate processing of the stanza if
   this comparison fails, which may be to display a message informing
   the recipient of the addresses in the certificate or other
   certificate details.

   The subject alternative name extension is used in S/MIME as the
   preferred means to convey the instant messaging and presence address
   that corresponds to the entity for this certificate.  Any XMPP
   address present in the certificate MUST be encoded using the ASN.1
   Object Identifier "id-on-xmppAddr" as specified in Section 5.1.1 of
   [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>].

<span class="h3"><a class="selflink" id="section-6.4" href="#section-6.4">6.4</a>.  Transfer Encoding</span>

   Because it is expected that XMPP applications will not interface with
   older 7-bit systems, the transfer encoding (as defined in <a href="#section-3.1.2">Section</a>
   <a href="#section-3.1.2">3.1.2</a> of [<a href="#ref-SMIME" title=""Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1 Message Specification"">SMIME</a>]) MUST be "binary".

<span class="h3"><a class="selflink" id="section-6.5" href="#section-6.5">6.5</a>.  Order of Signing and Encrypting</span>

   If a stanza is both signed and encrypted, it SHOULD be signed first,
   then encrypted.

<span class="h3"><a class="selflink" id="section-6.6" href="#section-6.6">6.6</a>.  Inclusion of Certificates</span>

   If the sender and recipient are involved in an active messaging
   session over a period of time, the sending agent SHOULD include the
   sender's certificate along with at least one encrypted message stanza
   every five minutes.  Outside the context of an active messaging
   session, the sending agent SHOULD include the sender's certificate
   along with each encrypted message stanza.  A sending agent MAY
   include the sender's certificate along with each encrypted presence
   stanza.  However, a sending agent SHOULD NOT include a certificate
   more than once every five minutes.




<span class="grey">Saint-Andre                 Standards Track                    [Page 16]</span>

<span id="page-17" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


<span class="h3"><a class="selflink" id="section-6.7" href="#section-6.7">6.7</a>.  Attachment and Checking of Signatures</span>

   Sending agents SHOULD attach a signature to each encrypted XML
   stanza.  If a signature is attached, a Content-Disposition header
   field (as defined in [<a href="#ref-DISP" title=""Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field"">DISP</a>]) SHOULD be included to specify how the
   signature is to be handled by the receiving application.

   If the receiving agent determines that the signature attached to an
   encrypted XML stanza is invalid, it SHOULD NOT present the stanza to
   the intended recipient (human or application), SHOULD provide some
   explicit alternate processing of the stanza (which may be to display
   a message informing the recipient that the attached signature is
   invalid), and MAY return a stanza error to the sender as described
   under Recipient Error Handling (<a href="#section-7">Section 7</a>).

<span class="h3"><a class="selflink" id="section-6.8" href="#section-6.8">6.8</a>.  Decryption</span>

   If the receiving agent is unable to decrypt the encrypted XML stanza,
   it SHOULD NOT present the stanza to the intended recipient (human or
   application), SHOULD provide some explicit alternate processing of
   the stanza (which may be to display a message informing the recipient
   that it has received a stanza that cannot be decrypted), and MAY
   return a stanza error to the sender as described under Recipient
   Error Handling (<a href="#section-7">Section 7</a>).

<span class="h3"><a class="selflink" id="section-6.9" href="#section-6.9">6.9</a>.  Inclusion and Checking of Timestamps</span>

   Timestamps are included in "Message/CPIM" and "application/pidf+xml"
   objects to help prevent replay attacks.  All timestamps MUST conform
   to [<a href="#ref-DATETIME" title=""Date and Time on the Internet: Timestamps"">DATETIME</a>] and be presented as UTC with no offset, including
   fractions of a second as appropriate.  Absent a local adjustment to
   the sending agent's perceived time or the underlying clock time, the
   sending agent MUST ensure that the timestamps it sends to the
   receiver increase monotonically (if necessary by incrementing the
   seconds fraction in the timestamp if the clock returns the same time
   for multiple requests).  The following rules apply to the receiving
   application:

   o  It MUST verify that the timestamp received is within five minutes
      of the current time.

   o  It SHOULD verify that the timestamp received is greater than any
      timestamp received in the last 10 minutes which passed the
      previous check.







<span class="grey">Saint-Andre                 Standards Track                    [Page 17]</span>

<span id="page-18" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   o  If any of the foregoing checks fails, the timestamp SHOULD be
      presented to the receiving entity (human or application) marked as
      "old timestamp", "future timestamp", or "decreasing timestamp",
      and the receiving entity MAY return a stanza error to the sender
      as described under Recipient Error Handling (<a href="#section-7">Section 7</a>).

<span class="h3"><a class="selflink" id="section-6.10" href="#section-6.10">6.10</a>.  Mandatory-to-Implement Cryptographic Algorithms</span>

   All implementations MUST support the following algorithms.
   Implementations MAY support other algorithms as well.

   For CMS SignedData:

   o  The SHA-1 message digest as specified in [<a href="#ref-CMS-ALG" title=""Cryptographic Message Syntax (CMS) Algorithms"">CMS-ALG</a>] <a href="#section-2.1">section 2.1</a>.

   o  The RSA (PKCS #1 v1.5) with SHA-1 signature algorithm, as
      specified in [<a href="#ref-CMS-ALG" title=""Cryptographic Message Syntax (CMS) Algorithms"">CMS-ALG</a>] <a href="#section-3.2">section 3.2</a>.

   For CMS EnvelopedData:

   o  The RSA (PKCS #1 v1.5) key transport, as specified in [<a href="#ref-CMS-ALG" title=""Cryptographic Message Syntax (CMS) Algorithms"">CMS-ALG</a>]
      <a href="#section-4.2.1">section 4.2.1</a>.

   o  The AES-128 encryption algorithm in CBC mode, as specified in
      [<a href="#ref-CMS-AES" title=""Use of the Advanced Encryption Standard (AES) Encryption Algorithm in Cryptographic Message Syntax (CMS)"">CMS-AES</a>].

<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>.  Recipient Error Handling</span>

   When an XMPP entity receives an XML stanza containing data that is
   signed and/or encrypted using the protocol described herein, several
   scenarios are possible:

   Case #1: The receiving application does not understand the protocol.

   Case #2: The receiving application understands the protocol and is
      able to decrypt the payload and verify the sender's signature.

   Case #3: The receiving application understands the protocol and is
      able to decrypt the payload and verify the sender's signature, but
      the timestamps fail the checks specified above under Checking of
      Timestamps (<a href="#section-6.9">Section 6.9</a>).

   Case #4: The receiving application understands the protocol and is
      able to decrypt the payload but is unable to verify the sender's
      signature.

   Case #5: The receiving application understands the protocol but is
      unable to decrypt the payload.



<span class="grey">Saint-Andre                 Standards Track                    [Page 18]</span>

<span id="page-19" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   In Case #1, the receiving application MUST do one and only one of the
   following: (1) ignore the <e2e/> extension, (2) ignore the entire
   stanza, or (3) return a <service-unavailable/> error to the sender,
   as described in [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>].

   In Case #2, the receiving application MUST NOT return a stanza error
   to the sender, since this is the success case.

   In Case #3, the receiving application MAY return a <not-acceptable/>
   error to the sender (as described in [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>]), optionally
   supplemented by an application-specific error condition element
   <bad-timestamp/> as shown below:

   Example 16: Recipient returns <not-acceptable/> error:

   <message from='[email protected]/orchard' type='chat'>
     <e2e xmlns='urn:ietf:params:xml:ns:xmpp-e2e'>
     [CDATA section here]
     </e2e>
     <error type='modify'>
       <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       <bad-timestamp xmlns='urn:ietf:params:xml:xmpp-e2e'/>
     </error>
   </message>

   In Case #4, the receiving application SHOULD return a
   <not-acceptable/> error to the sender (as described in [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>]),
   optionally supplemented by an application-specific error condition
   element <unverified-signature/> as shown below:

   Example 17: Recipient returns <not-acceptable/> error:

   <message from='[email protected]/orchard' type='chat'>
     <e2e xmlns='urn:ietf:params:xml:ns:xmpp-e2e'>
     [CDATA section here]
     </e2e>
     <error type='modify'>
       <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       <unverified-signature xmlns='urn:ietf:params:xml:xmpp-e2e'/>
     </error>
   </message>

   In Case #5, the receiving application SHOULD return a <bad-request/>
   error to the sender (as described in [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>]), optionally
   supplemented by an application-specific error condition element
   <decryption-failed/> as shown below:





<span class="grey">Saint-Andre                 Standards Track                    [Page 19]</span>

<span id="page-20" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Example 18: Recipient returns <bad-request/> error:

   <message from='[email protected]/orchard' type='chat'>
     <e2e xmlns='urn:ietf:params:xml:ns:xmpp-e2e'>
     [CDATA section here]
     </e2e>
     <error type='modify'>
       <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       <decryption-failed xmlns='urn:ietf:params:xml:xmpp-e2e'/>
     </error>
   </message>

<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>.  Secure Communications Through a Gateway</span>

   A common method for achieving interoperability between two disparate
   services is through the use of a "gateway" that interprets the
   protocols of each service and translates them into the protocols of
   the other.  The CPIM specifications (specifically [<a href="#ref-MSGFMT" title=""Common Presence and Instant Messaging (CPIM): Message Format"">MSGFMT</a>] and [<a href="#ref-PIDF" title=""Presence Information Data Format (PIDF)"">PIDF</a>]
   define the common profiles to be used for interoperability between
   instant messaging and presence services that comply with [<a href="#ref-IMP-REQS" title=""Instant Messaging/Presence Protocol Requirements"">IMP-REQS</a>].
   In the case of communications between an XMPP service and a non-XMPP
   service, we can visualize this relationship as follows:

   +-------------+        +-------------+        +------------+
   |             |        |             |        |            |
   |    XMPP     |        |  XMPP-CPIM  |        |  Non-XMPP  |
   |   Service   | <----> |   Gateway   | <----> |  Service   |
   |             |        |             |        |            |
   +-------------+        +-------------+        +------------+

   The end-to-end encryption method defined herein enables the exchange
   of encrypted and/or signed instant messages and presence through an
   XMPP-CPIM gateway.  In particular:

   o  When a gateway receives a secured XMPP message or presence stanza
      from the XMPP service that is addressed to a user on the non-XMPP
      service, it MUST remove the XMPP "wrapper" (everything down to and
      including the <e2e> and </e2e> tags) in order to reveal the
      multipart S/MIME object, then route the object to the non-XMPP
      service (first wrapping it in the protocol used by the non-XMPP
      service if necessary).










<span class="grey">Saint-Andre                 Standards Track                    [Page 20]</span>

<span id="page-21" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   o  When a gateway receives a secured non-XMPP instant message or
      presence document from the non-XMPP service that is addressed to a
      user on the XMPP service, it MUST remove the non-XMPP "wrapper"
      (if any) in order to reveal the multipart S/MIME object, wrap the
      object in an XMPP message or presence "wrapper" (including the
      <e2e> and </e2e> tags), and then route the XMPP stanza to the XMPP
      service.

   The wrapped S/MIME object MUST be immutable and MUST NOT be modified
   by an XMPP-CPIM gateway.

<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>.  urn:ietf:params:xml:xmpp-e2e Namespace</span>

   The <e2e xmlns='urn:ietf:params:xml:ns:xmpp-e2e'/> element is a
   wrapper for an XML CDATA section (see Section 2.7 of [<a href="#ref-XML" title=""Extensible Markup Language (XML) 1.0 (3rd ed)"">XML</a>]) that
   contains a "Message/CPIM", "application/pidf+xml", or
   "application/xmpp+xml" object.  Thus the
   'urn:ietf:params:xml:xmpp-e2e' namespace has no inherent semantics,
   and the semantics of the encapsulated object are defined by one of
   the following specifications:

   o  [<a href="#ref-MSGFMT" title=""Common Presence and Instant Messaging (CPIM): Message Format"">MSGFMT</a>] for "Message/CPIM"
   o  [<a href="#ref-PIDF" title=""Presence Information Data Format (PIDF)"">PIDF</a>] for "application/pidf+xml"
   o  [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>] for "application/xmpp+xml"

   Although the "application/xmpp+xml" media type is specified in this
   document, the <xmpp/> element is simply a wrapper for a <message/>,
   <presence/>, or <iq/> stanza, where the semantics of those stanza
   types are specified in [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>].

   Given that the 'urn:ietf:params:xml:ns:xmpp-e2e' namespace has no
   inherent semantics and specifies a using protocol only, versioning is
   the responsibility of the protocols that define the encapsulated
   objects ([<a href="#ref-MSGFMT" title=""Common Presence and Instant Messaging (CPIM): Message Format"">MSGFMT</a>], [<a href="#ref-PIDF" title=""Presence Information Data Format (PIDF)"">PIDF</a>], and [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>]).

<span class="h2"><a class="selflink" id="section-10" href="#section-10">10</a>.  application/xmpp+xml Media Type</span>

   The "application/xmpp+xml" media type adheres to the guidelines
   specified in [<a href="#ref-XML-MEDIA" title=""XML Media Types"">XML-MEDIA</a>].  The root element for this MIME type is
   <xmpp/>, and the root element MUST contain one and only one child
   element, corresponding to one of the XMPP stanza types (i.e.,
   message, presence, or iq) if the default namespace is 'jabber:client'
   or 'jabber:server' as defined in [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>].  The character encoding
   for this XML media type MUST be UTF-8, in accordance with <a href="#section-11.5">Section</a>
   <a href="#section-11.5">11.5</a> of [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>].






<span class="grey">Saint-Andre                 Standards Track                    [Page 21]</span>

<span id="page-22" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


<span class="h2"><a class="selflink" id="section-11" href="#section-11">11</a>.  Security Considerations</span>

   This entire memo discusses security.  Detailed security
   considerations for instant messaging and presence protocols are given
   in [<a href="#ref-IMP-REQS" title=""Instant Messaging/Presence Protocol Requirements"">IMP-REQS</a>] (Sections <a href="#section-5.1">5.1</a> through <a href="#section-5.4">5.4</a>), and for XMPP in particular
   are given in [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>] (Sections <a href="#section-12.1">12.1</a> through <a href="#section-12.6">12.6</a>).  In addition,
   all of the security considerations specified in [<a href="#ref-XML-MEDIA" title=""XML Media Types"">XML-MEDIA</a>] apply to
   the "application/xmpp+xml" media type.

   The end-to-end security method defined here MAY result in exchanging
   secured instant messages and presence information through a gateway
   that implements the CPIM specifications.  Such a gateway MUST be
   compliant with the minimum security requirements of the instant
   messaging and presence protocols with which it interfaces.

<span class="h2"><a class="selflink" id="section-12" href="#section-12">12</a>.  IANA Considerations</span>

<span class="h3"><a class="selflink" id="section-12.1" href="#section-12.1">12.1</a>.  XML Namespace Name for e2e Data in XMPP</span>

   A URN sub-namespace of signed and encrypted content for the
   Extensible Messaging and Presence Protocol (XMPP) is defined as
   follows.  (This namespace name adheres to the format defined in
   [<a href="#ref-XML-REG" title=""The IETF XML Registry"">XML-REG</a>].)

   URI: urn:ietf:params:xml:ns:xmpp-e2e
   Specification: <a href="./rfc3923">RFC 3923</a>
   Description: This is an XML namespace name of signed and encrypted
      content for the Extensible Messaging and Presence Protocol as
      defined by <a href="./rfc3923">RFC 3923</a>.
   Registrant Contact: IESG, <iesg@ietf.org>

<span class="h3"><a class="selflink" id="section-12.2" href="#section-12.2">12.2</a>.  Content-type Registration for "application/xmpp+xml"</span>

   To: [email protected]

   Subject: Registration of MIME media type application/xmpp+xml

   MIME media type name: application
   MIME subtype name: xmpp+xml
   Required parameters: (none)
   Optional parameters: (charset) Same as charset parameter of
      application/xml as specified in <a href="./rfc3023">RFC 3023</a>; per Section 11.5 of
      [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>], the charset must be UTF-8.
   Encoding considerations: Same as encoding considerations of
      application/xml as specified in <a href="./rfc3023">RFC 3023</a>; per Section 11.5 of
      [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>], the encoding must be UTF-8.





<span class="grey">Saint-Andre                 Standards Track                    [Page 22]</span>

<span id="page-23" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   Security considerations: All of the security considerations specified
      in <a href="./rfc3023">RFC 3023</a> and [<a href="#ref-XMPP-CORE" title=""Extensible Messaging and Presence Protocol (XMPP): Core"">XMPP-CORE</a>] apply to this XML media type.  Refer
      to <a href="./rfc3923#section-11">Section 11 of RFC 3923</a>.
   Interoperability considerations: (none)
   Specification: <a href="./rfc3923">RFC 3923</a>
   Applications which use this media type: XMPP-compliant instant
      messaging and presence systems.
   Additional information: (none)
   Person and email address to contact for further information: IESG,
      <iesg@ietf.org>
   Intended usage: COMMON
   Author/Change controller: IETF, XMPP Working Group

<span class="h2"><a class="selflink" id="section-13" href="#section-13">13</a>.  References</span>

<span class="h3"><a class="selflink" id="section-13.1" href="#section-13.1">13.1</a>.  Normative References</span>

   [<a id="ref-CERT">CERT</a>]        Ramsdell, B., Ed., "Secure/Multipurpose Internet Mail
                 Extensions (S/MIME) Version 3.1 Certificate Handling",
                 <a href="./rfc3850">RFC 3850</a>, July 2004.

   [<a id="ref-CMS">CMS</a>]         Housley, R., "Cryptographic Message Syntax (CMS)", <a href="./rfc3852">RFC</a>
                 <a href="./rfc3852">3852</a>, July 2004.

   [<a id="ref-CMS-AES">CMS-AES</a>]     Schaad, J., "Use of the Advanced Encryption Standard
                 (AES) Encryption Algorithm in Cryptographic Message
                 Syntax (CMS)", <a href="./rfc3565">RFC 3565</a>, July 2003.

   [<a id="ref-CMS-ALG">CMS-ALG</a>]     Housley, R., "Cryptographic Message Syntax (CMS)
                 Algorithms", <a href="./rfc3370">RFC 3370</a>, August 2002.

   [<a id="ref-CPIM">CPIM</a>]        Peterson, J., "Common Profile for Instant Messaging
                 (CPIM)", <a href="./rfc3860">RFC 3860</a>, August 2004.

   [<a id="ref-CPP">CPP</a>]         Peterson, J., "Common Profile for Presence (CPP)", <a href="./rfc3859">RFC</a>
                 <a href="./rfc3859">3859</a>, August 2004.

   [<a id="ref-DATETIME">DATETIME</a>]    Klyne, G. and C. Newman, "Date and Time on the
                 Internet:  Timestamps", <a href="./rfc3339">RFC 3339</a>, July 2002.

   [<a id="ref-DISP">DISP</a>]        Troost, R., Dorner, S., and K. Moore, Ed.,
                 "Communicating Presentation Information in Internet
                 Messages: The Content-Disposition Header Field", <a href="./rfc2183">RFC</a>
                 <a href="./rfc2183">2183</a>, August 1997.

   [<a id="ref-IMP-MODEL">IMP-MODEL</a>]   Day, M., Rosenberg, J., and H. Sugano, "A Model for
                 Presence and Instant Messaging", <a href="./rfc2778">RFC 2778</a>, February
                 2000.



<span class="grey">Saint-Andre                 Standards Track                    [Page 23]</span>

<span id="page-24" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


   [<a id="ref-IMP-REQS">IMP-REQS</a>]    Day, M., Aggarwal, S., Mohr, G., and J. Vincent,
                 "Instant Messaging/Presence Protocol Requirements", <a href="./rfc2779">RFC</a>
                 <a href="./rfc2779">2779</a>, February 2000.

   [<a id="ref-MSGFMT">MSGFMT</a>]      Klyne, G. and D. Atkins, "Common Presence and Instant
                 Messaging (CPIM): Message Format", <a href="./rfc3862">RFC 3862</a>, August
                 2004.

   [<a id="ref-MULTI">MULTI</a>]       Galvin, J., Murphy, S., Crocker, S., and N. Freed,
                 "Security Multiparts for MIME: Multipart/Signed and
                 Multipart/Encrypted", <a href="./rfc1847">RFC 1847</a>, October 1995.

   [<a id="ref-PIDF">PIDF</a>]        Sugano, H., Fujimoto, S., Klyne, G., Bateman, A., Carr,
                 W., and J. Peterson, "Presence Information Data Format
                 (PIDF)", <a href="./rfc3863">RFC 3863</a>, August 2004.

   [<a id="ref-SMIME">SMIME</a>]       Ramsdell, B., Ed., "Secure/Multipurpose Internet Mail
                 Extensions (S/MIME) Version 3.1 Message Specification",
                 <a href="./rfc3851">RFC 3851</a>, July 2004.

   [<a id="ref-TERMS">TERMS</a>]       Bradner, S., "Key words for use in RFCs to Indicate
                 Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.

   [<a id="ref-XML-MEDIA">XML-MEDIA</a>]   Murata, M., St. Laurent, S. and D. Kohn, "XML Media
                 Types", <a href="./rfc3023">RFC 3023</a>, January 2001.

   [<a id="ref-XMPP-CORE">XMPP-CORE</a>]   Saint-Andre, P., Ed., "Extensible Messaging and
                 Presence Protocol (XMPP): Core", <a href="./rfc3920">RFC 3920</a>, October
                 2004.

   [<a id="ref-XMPP-IM">XMPP-IM</a>]     Saint-Andre, P., Ed., "Extensible Messaging and
                 Presence Protocol (XMPP) Instant Messaging and
                 Presence", <a href="./rfc3921">RFC 3921</a>, October 2004.


















<span class="grey">Saint-Andre                 Standards Track                    [Page 24]</span>

<span id="page-25" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


<span class="h3"><a class="selflink" id="section-13.2" href="#section-13.2">13.2</a>.  Informative References</span>

   [<a id="ref-CAPS">CAPS</a>]        Hildebrand, J. and P. Saint-Andre, "Entity
                 Capabilities", JSF JEP 0115, August 2004.

   [<a id="ref-CMC">CMC</a>]         Myers, M., Liu, X., Schaad, J. and J. Weinstein,
                 "Certificate Management Messages over CMS", <a href="./rfc2797">RFC 2797</a>,
                 April 2000.

   [<a id="ref-CMP">CMP</a>]         Adams, C. and S. Farrell, "Internet X.509 Public Key
                 Infrastructure Certificate Management Protocols", <a href="./rfc2510">RFC</a>
                 <a href="./rfc2510">2510</a>, March 1999.

   [<a id="ref-DISCO">DISCO</a>]       Hildebrand, J., Millard, P., Eatmon, R. and P.  Saint-
                 Andre, "Service Discovery", JSF JEP 0030, July 2004.

   [<a id="ref-MUC">MUC</a>]         Saint-Andre, P., "Multi-User Chat", JSF JEP 0045, June
                 2004.

   [<a id="ref-XML">XML</a>]         Bray, T., Paoli, J., Sperberg-McQueen, C. and E. Maler,
                 "Extensible Markup Language (XML) 1.0 (3rd ed)", W3C
                 REC-xml, February 2004, <<a href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</a>>.

   [<a id="ref-XML-REG">XML-REG</a>]     Mealling, M., "The IETF XML Registry", <a href="https://www.rfc-editor.org/bcp/bcp81">BCP 81</a>, <a href="./rfc3688">RFC</a>
                 <a href="./rfc3688">3688</a>, January 2004.


























<span class="grey">Saint-Andre                 Standards Track                    [Page 25]</span>

<span id="page-26" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


<span class="h2"><a class="selflink" id="appendix-A" href="#appendix-A">Appendix A</a>.  Schema for urn:ietf:params:xml:ns:xmpp-e2e</span>

   The following XML schema is descriptive, not normative.

   <?xml version='1.0' encoding='UTF-8'?>

   <xs:schema
       xmlns:xs='http://www.w3.org/2001/XMLSchema'
       targetNamespace='urn:ietf:params:xml:ns:xmpp-e2e'
       xmlns='urn:ietf:params:xml:ns:xmpp-e2e'
       elementFormDefault='qualified'>

     <xs:element name='e2e' type='xs:string'/>

     <xs:element name='decryption-failed' type='empty'/>
     <xs:element name='signature-unverified' type='empty'/>
     <xs:element name='bad-timestamp' type='empty'/>

     <xs:simpleType name='empty'>
       <xs:restriction base='xs:string'>
         <xs:enumeration value=''/>
       </xs:restriction>
     </xs:simpleType>

   </xs:schema>

Author's Address

   Peter Saint-Andre
   Jabber Software Foundation

   EMail: [email protected]



















<span class="grey">Saint-Andre                 Standards Track                    [Page 26]</span>

<span id="page-27" ></span>
<span class="grey"><a href="./rfc3923">RFC 3923</a>                        XMPP E2E                    October 2004</span>


Full Copyright Statement

   Copyright (C) The Internet Society (2004).

   This document is subject to the rights, licenses and restrictions
   contained in <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a>, and except as set forth therein, the authors
   retain all their rights.

   This document and the information contained herein are provided on an
   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/S HE
   REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE
   INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
   THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Intellectual Property

   The IETF takes no position regarding the validity or scope of any
   Intellectual Property Rights or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; nor does it represent that it has
   made any independent effort to identify any such rights.  Information
   on the IETF's procedures with respect to rights in IETF Documents can
   be found in <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and <a href="https://www.rfc-editor.org/bcp/bcp79">BCP 79</a>.

   Copies of IPR disclosures made to the IETF Secretariat and any
   assurances of licenses to be made available, or the result of an
   attempt made to obtain a general license or permission for the use of
   such proprietary rights by implementers or users of this
   specification can be obtained from the IETF on-line IPR repository at
   <a href="http://www.ietf.org/ipr">http://www.ietf.org/ipr</a>.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights that may cover technology that may be required to implement
   this standard.  Please address the information to the IETF at ietf-
   [email protected].

Acknowledgement

   Funding for the RFC Editor function is currently provided by the
   Internet Society.







Saint-Andre                 Standards Track                    [Page 27]

Additional Resources