XEP-XXXX: Jingle Encrypted Transfers

Abstract:This specification defines a method that allows file transfers via Jingle File Transfer to be end-to-end encrypted using established encryption schemes like OpenPGP or OMEMO.
Author:Paul Schaub
Copyright:© 1999 – 2017 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status:ProtoXEP
Type:Standards Track
Version:0.0.1
Last Updated:2017-06-12

WARNING: This document has not yet been accepted for consideration or approved in any official manner by the XMPP Standards Foundation, and this document is not yet an XMPP Extension Protocol (XEP). If this document is accepted as a XEP by the XMPP Council, it will be published at <http://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.


Table of Contents


1. Introduction
2. How it works
    2.1. File offer
    2.2. File Request
3. Open Questions

Appendices
    A: Document Information
    B: Author Information
    C: Legal Notices
    D: Relation to XMPP
    E: Discussion Venue
    F: Requirements Conformance
    G: Notes
    H: Revision History


1. Introduction

Jingle File Transfer (XEP-0234) [1] has the disadvantage, that transmitted files are not encrypted (aside from regular TLS transport encryption), which means that intermediate nodes like the XMPP server(s) have access to the transferred data. Considering that end-to-end encryption becomes more and more important for communications, this is a major flaw that needs to be addressed.

This document defines a method to enable two communication partners to utilize an already established secure channel (eg. an OMEMO session) to exchange an encryption key which can then be used to encrypt/decrypt the offered/requested file.

2. How it works

In order to initiate an encrypted file transfer, the initiator includes a key-element in the jingle-request. This key-element contains an encryption key which is used to encrypt/decryt the transferred key. In both file offers and file requests, it is the initiator, which dictates this key. The key is encrypted using the encryption method of the initiators choice. The initiator and responder must establish a session beforehand.

2.1 File offer

In this scenario Romeo wants to send an encrypted text file over to Juliet. He chooses to use their existing OMEMO session to do so. First, he generates a fresh TODO-AES key and IV. This will later be used to encrypt and decrypt the file. In order to be transmitted, key and IV have to be serialized. Key and IV are both Base64 encoded and appended in the following form:

Example 1. Key and IV get serialized

KEY:HEREISYOURKEY|IV:HEREYOUFINDIV

This text is encrypted using the established secure encryption method. The resulting OMEMO element is sent as part of the security element along with the rest of the jingle stanza over to Juliet.

Example 2. Romeo initiates an encrypted file offer

<iq from='romeo@montague.example/dr4hcr0st3lup4c'
    id='nzu25s8'
    to='juliet@capulet.example/yn0cl4bnw0yr3vym'
    type='set'>
  <jingle xmlns='urn:xmpp:jingle:1'
          action='session-initiate'
          initiator='romeo@montague.example/dr4hcr0st3lup4c'
          sid='851ba2'>
    <content creator='initiator' name='a-file-offer' senders='initiator'>
      <description xmlns='urn:xmpp:jingle:apps:file-transfer:5'>
        <file>
          <date>1969-07-21T02:56:15Z</date>
          <desc>This is a test. If this were a real file...</desc>
          <media-type>text/plain</media-type>
          <name>test.txt</name>
          <range/>
          <size>6144</size>
          <hash xmlns='urn:xmpp:hashes:2'
                algo='sha-1'>w0mcJylzCn+AfvuGdqkty2+KP48=</hash>
        </file>
      </description>
      <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
                 mode='tcp'
                 sid='vj3hs98y'>
        <candidate cid='hft54dqy'
                   host='192.168.4.1'
                   jid='romeo@montague.example/dr4hcr0st3lup4c'
                   port='5086'
                   priority='8257636'
                   type='direct'/>
      </transport>
      <security xmlns='TODO' name='a-file-offer' type='omemo'>
        <encrypted xmlns='urn:xmpp:omemo:0'>
          <header sid='27183'>
            <key rid='31415'>BASE64ENCODED...</key>
            <key rid='12321'>BASE64ENCODED...</key>
            <iv>BASE64ENCODED...</iv>
          </header>
          <payload>BASE64-ENCODED-ENCRYPTED-KEY</payload>
        </encrypted>
      </security>
    </content>
  </jingle>
</iq>

Juliet decrypts the OMEMO element using her session with Romeo to retrieve the key and IV. Both Juliet and Romeo then carry on with the session negotiation as described in Jingle File Transfer (XEP-0234) [1]. Before Romeo starts transmitting the file, he encrypts it using the key and IV. He then transmitts the encrypted file over to Juliet.

When Juliet received the file, she uses the decrypted key and IV to decrypt the received file.

2.2 File Request

Juliet might want to request a file transfer from Romeo. This can be the case, when Romeo hosts the file. In order to do so, she sends him a key and IV which Romeo will use to encrypt the file before sending it to Juliet. In this example we assume, that Romeo and Juliet secured their communications using OpenPGP for XMPP Instant Messaging (XEP-0374) [2].

Example 3. Juliet initiates an encrypted file request

<iq from='juliet@capulet.example/yn0cl4bnw0yr3vym'
    id='wsn361c3'
    to='romeo@montague.example/dr4hcr0st3lup4c'
    type='set'>
  <jingle xmlns='urn:xmpp:jingle:1'
          action='session-initiate'
          initiator='juliet@capulet.example/yn0cl4bnw0yr3vym'
          sid='uj3b2'>
    <content creator='initiator' name='a-file-request' senders='responder'>
      <description xmlns='urn:xmpp:jingle:apps:file-transfer:5'>
        <file>
          <hash xmlns='urn:xmpp:hashes:2'
                algo='sha-1'>w0mcJylzCn+AfvuGdqkty2+KP48=</hash>
        </file>
      </description>
      <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
                 mode='tcp'
                 sid='xig361fj'>
        <candidate cid='ht567dq'
                   host='192.169.1.10'
                   jid='juliet@capulet.example/yn0cl4bnw0yr3vym'
                   port='6539'
                   priority='8257636'
                   type='direct'/>
      </transport>
      <security xmlns='TODO' name='a-file-request' type='openpgp'>
        <signcrypt xmlns='urn:xmpp:openpgp:0'>
          <to jid='romeo@montague.example'/>
          <time stamp='2014-07-10T17:06:00+02:00'/>
          <rpad>f0rm1l4n4-mT8y33j!Y%fRSrcd^ZE4Q7VDt1L%WEgR!kv</rpad>
          <payload>
            <body xmlns='jabber:client'>BASE64-ENCODED-ENCRYPTED-KEY</body>
          </payload>
        </signcrypt>
      </security>
    </content>
  </jingle>
</iq>

3. Open Questions

This is only a rough draft and there is still a ton of questions left to be answered. Here is a small non-exhaustive list of things I can think of:


Appendices


Appendix A: Document Information

Series: XEP
Number: XXXX
Publisher: XMPP Standards Foundation
Status: ProtoXEP
Type: Standards Track
Version: 0.0.1
Last Updated: 2017-06-12
Approving Body: XMPP Council
Dependencies: XEP-0234
Supersedes: None
Superseded By: None
Short Name: jet
XML Schema for the 'jingle' namespace: <http://xmpp.org/schemas/jingle.xsd>
XML Schema for the 'jingle:errors' namespace: <http://xmpp.org/schemas/jingle-errors.xsd>
Registry: <http://xmpp.org/registrar/jet.html>
This document in other formats: XML  PDF


Appendix B: Author Information

Paul Schaub

Email: vanitasvitae@riseup.net
JabberID: vanitasvitae@jabberhead.tk


Appendix C: Legal Notices

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2017 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).

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

There exists a special venue for discussion related to the technology described in this document: the <jingle@xmpp.org> mailing list.

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-0234: Jingle File Transfer <https://xmpp.org/extensions/xep-0234.html>.

2. XEP-0374: OpenPGP for XMPP Instant Messaging <https://xmpp.org/extensions/xep-0374.html>.


Appendix H: Revision History

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

Version 0.0.1 (2017-06-12)

First draft

(vv)

END