XEP-0380: Explicit Message Encryption

Abstract
This specification provides a way to mark encrypted messages so the recipient can discover how to decrypt it.
Author
Emmanuel Gil Peyrot
Copyright
© 1999 – 2020 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Experimental

WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.
Type
Standards Track
Version
0.3.0 (2019-04-28)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Draft
  4. Final

1. Introduction

In the past few years we have seen a strong interest in end to end encryption, with multiple competing mechanisms being defined on top of XMPP (e.g., Current Jabber OpenPGP Usage (XEP-0027) [1], Current Off-the-Record Messaging Usage (XEP-0364) [2] or OpenPGP for XMPP (XEP-0373) [3]). This specification addresses the lack of proper discoverability of most of these solutions by adding a machine-readable explanation of how a specific message has been encrypted.

In a federated network where no central entity can mandate a particular encryption mechanism, it becomes important to allow end users to know that a message could not be decrypted (e.g., due to a missing plugin), and to never fail to display that a message has been received due to that.

2. Requirements

This document addresses the following requirements:

  1. Enable a client to mark a message as encrypted.
  2. Enable a client to determine whether a message was encrypted, no matter the encryption mechanism used.
  3. Enable a client to offer the user a possibility to decrypt a received message (depending on the encryption method).
  4. Enable a client to offer the user a possibility to decrypt subsequently received messages.

This document DOES NOT address the non-message usecases, encrypted presence and iq have very different requirements than those defined here.

3. Use Cases

3.1 Basic Flow

Romeo, wanting to get Juliet’s attention but not wanting to reveal his intentions to the montague.lit nor to the capulet.lit servers, sends an encrypted message tagged as OTR, as follows:

Example 1. Example of tagged message encrypted with OTR
<message to='juliet@capulet.lit/balcony'
         from='romeo@montague.lit/orchard'
         id='secret1'>
  <body>?OTR?v23?...</body>
  <encryption xmlns='urn:xmpp:eme:0'
              namespace='urn:xmpp:otr:0'/>
</message>

Juliet’s client, noticing it does not have any OTR capability, will display that the message was encrypted but that it is not able to decrypt it instead of displaying the body, for example:

This message was encrypted with OTR (urn:xmpp:otr:0) and could not be decrypted.

Juliet may then communicate to Romeo that she was unable to receive his message, through an error, or maybe out of band.

Romeo, standing firm in his belief that they should not communicate without encryption in their world where anyone could be a malicious listener, then discovers that one of Juliet’s clients support OpenPGP for XMPP (XEP-0373) [3] and subsequently starts an encrypted session using that protocol.

Example 2. Example of tagged message encrypted with OX
<message to='juliet@capulet.lit/balcony'
         from='romeo@montague.lit/orchard'
         id='secret2'>
  <openpgp xmlns='urn:xmpp:openpgp:0'>
    ...
  </openpgp>
  <body>This message is encrypted with OpenPGP for XMPP.</body>
  <encryption xmlns='urn:xmpp:eme:0'
              namespace='urn:xmpp:openpgp:0'/>
</message>

Upon receiving this message, Juliet’s current client prompts her to enable a plugin, or even do it on its own, possible representations include:

This message was encrypted with OpenPGP for XMPP (urn:xmpp:openpgp:0), click here to enable this plugin.

3.2 Protocols Supported

Any encryption mechanism using message as a transport is a candidate, and MAY have a 'name' attribute to help the receiving client display it to the user, in case this client doesn’t understand its namespace yet. A 'name' attribute SHOULD NOT be included for the protocols listed herein, and SHOULD be ignored by a receiving client:

Table 1:
Name Namespace Specification
OTR urn:xmpp:otr:0 Current Off-the-Record Messaging Usage (XEP-0364) [2]
Legacy OpenPGP jabber:x:encrypted Current Jabber OpenPGP Usage (XEP-0027) [1]
OpenPGP for XMPP urn:xmpp:openpgp:0 OpenPGP for XMPP (XEP-0373) [3]
OMEMO eu.siacs.conversations.axolotl OMEMO Encryption (XEP-0384) [4]

3.3 Determining Support

If an entity supports the Encrypted Message Extension protocol, it MUST report that by including a Service Discovery (XEP-0030) [5] feature of "urn:xmpp:eme:0" in response to disco#info requests:

Example 3. Client queries for entity features
<iq type='get'
    id='disco1'
    to='juliet@capulet.lit/balcony'
    from='romeo@montague.lit/orchard'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
Example 4. Entity responds with features
<iq type='result'
    id='disco1'
    to='romeo@montague.lit/orchard'
    from='juliet@capulet.lit/balcony'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='urn:xmpp:eme:0'/>
    ...
  </query>
</iq>

Support can also be determined via Entity Capabilities (XEP-0115) [6], a.k.a. "caps".

4. Business Rules

Entities MUST report a failure to the user if they cannot decrypt an incoming message for any reason, and MAY prompt the user to install or enable a plugin to decrypt it.

Entities SHOULD include a non-encrypted body as possible, since older clients not supporting this protocol might otherwise ignore messages sent with an unknown encryption, making both the sender frustrated that their message did not get an answer, and the recipient frustrated that they never saw any message.

A sender entity MAY include the <encryption/> element even if the recipient doesn’t advertise support for it in their disco, or isn’t currently connected, since the recipient may be using multiple clients with different capabilities.

A sender entity MAY include a 'name' attribute for any encryption mechanism not listed in this specification, to help the receiving entity present it to the user, but SHOULD NOT include one for the ones listed here.

A receiving entity MUST NOT use the 'name' attribute if it is present and they already have a name associated with it.

A receiving entity MAY not display anything in case an encrypted message has been received, if the user agreed to that behaviour.

5. Internationalization Considerations

When a message is marked with an encryption tag and can not be decrypted, the body can safely be ignored and a localized message displayed instead.

If an entity includes a 'name' attribute, it should attempt to localise it to the best of its abilities for the receiving client.

6. Security Considerations

A malicious entity could try to mimick the style of a client’s failure message, maybe including a link to a compromised plugin, so a client should not make those missing plugin messages look like normal messages.

7. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA).

8. XMPP Registrar Considerations

8.1 Protocol Namespaces

This specification defines the following XML namespace:

9. XML Schema

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

<xs:schema attributeFormDefault="unqualified"
  elementFormDefault="qualified"
  targetNamespace="urn:xmpp:eme:0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-xxxx: http://xmpp.org/extensions/xep-xxxx.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name="encryption">
    <xs:complexType>
      <xs:attribute type="xs:string" use="required" name="namespace"/>
      <xs:attribute type="xs:string" use="optional" name="name"/>
    </xs:complexType>
  </xs:element>

</xs:schema>

10. Acknowledgements

Thanks to Mathieu Pasquet for his feedback.


Appendices

Appendix A: Document Information

Series
XEP
Number
0380
Publisher
XMPP Standards Foundation
Status
Experimental
Type
Standards Track
Version
0.3.0
Last Updated
2019-04-28
Approving Body
XMPP Council
Dependencies
XMPP Core, XMPP IM, XEP-0030
Supersedes
None
Superseded By
None
Short Name
EME
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Emmanuel Gil Peyrot
Email
linkmauve@linkmauve.fr
JabberID
linkmauve@linkmauve.fr

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2020 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

1. XEP-0027: Current Jabber OpenPGP Usage <https://xmpp.org/extensions/xep-0027.html>.

2. XEP-0364: Current Off-the-Record Messaging Usage <https://xmpp.org/extensions/xep-0364.html>.

3. XEP-0373: OpenPGP for XMPP <https://xmpp.org/extensions/xep-0373.html>.

4. XEP-0384: OMEMO Encryption <https://xmpp.org/extensions/xep-0384.html>.

5. XEP-0030: Service Discovery <https://xmpp.org/extensions/xep-0030.html>.

6. XEP-0115: Entity Capabilities <https://xmpp.org/extensions/xep-0115.html>.

Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

  1. Version 0.3.0 (2019-04-28)

    Added OMEMO encryption namespace.

    Made XEP experimental again.

    lnj
  2. Version 0.2.0 (2018-01-25)
    Defer due to lack of activity.
    XEP Editor (jwi)
  3. Version 0.1 (2016-10-26)

    Initial published version approved by the XMPP Council.

    fs
  4. Version 0.0.2 (2016-08-28)
    egp
  5. Version 0.0.1 (2016-08-14)

    First draft.

    egp

END