No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0391.xml 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY security "&lt;security/&gt;">
  4. <!ENTITY % ents SYSTEM 'xep.ent'>
  5. %ents;
  6. ]>
  7. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  8. <xep>
  9. <header>
  10. <title>Jingle Encrypted Transports</title>
  11. <abstract>This specification defines a method that allows to use established encryption schemes for end-to-end encryption of Jingle transports.</abstract>
  12. &LEGALNOTICE;
  13. <number>0391</number>
  14. <status>Experimental</status>
  15. <type>Standards Track</type>
  16. <sig>Standards</sig>
  17. <approver>Council</approver>
  18. <dependencies>
  19. <spec>XEP-0166</spec>
  20. </dependencies>
  21. <supersedes/>
  22. <supersededby/>
  23. <shortname>jet</shortname>
  24. <schemaloc>
  25. <ns>jingle</ns>
  26. <url>http://xmpp.org/schemas/jingle.xsd</url>
  27. </schemaloc>
  28. <schemaloc>
  29. <ns>jingle:errors</ns>
  30. <url>http://xmpp.org/schemas/jingle-errors.xsd</url>
  31. </schemaloc>
  32. <registry/>
  33. <discuss>jingle</discuss>
  34. &paulschaub;
  35. <revision>
  36. <version>0.1.1</version>
  37. <date>2017-10-09</date>
  38. <initials>vv</initials>
  39. <remark>
  40. <p>Remove remnant TODO section</p>
  41. <p>Remove mentionings about key seralization (handled by extensions)</p>
  42. <p>Fix typos</p>
  43. <p>Add acknowledgements</p>
  44. </remark>
  45. </revision>
  46. <revision>
  47. <version>0.1</version>
  48. <date>2017-09-27</date>
  49. <initials>XEP Editor: jwi</initials>
  50. <remark><p>Accepted as Experimental by Council.</p></remark>
  51. </revision>
  52. <revision>
  53. <version>0.0.1</version>
  54. <date>2017-06-12</date>
  55. <initials>vv</initials>
  56. <remark><p>First draft</p></remark>
  57. </revision>
  58. </header>
  59. <section1 topic='Introduction' anchor='intro'>
  60. <p>Jingle Encrypted Transports (JET) strives to provide a modular and easily extensible way to wrap Jingle Transports in an additional end-to-end encryption layer. The focus of this specification lays on being modular. It should be possible to extend existing Jingle use scenarios with end-to-end encryption by simply adding a JET element to the negotiation.</p>
  61. </section1>
  62. <section1 topic='Terminology' anchor='terminology'>
  63. <p>JET uses multiple encryption layers, so it is necessary to declare a distinct denomination for the different keys involved.</p>
  64. <table caption='Denomination of keys used in the protocol'>
  65. <tr>
  66. <th>Designation</th>
  67. <th>Abbrevation</th>
  68. <th>Usage</th>
  69. </tr>
  70. <tr>
  71. <td>Transport Key</td>
  72. <td>TK</td>
  73. <td>(Symmetric) key that is used to encrypt/decrypt the bytestreams sent/received through Jingle transports. This key encrypts the data two entities want to exchange. Examples for TK can be found under <link url='#ciphers'>"Ciphers"</link>.</td>
  74. </tr>
  75. <tr>
  76. <td>Initialization Vector</td>
  77. <td>IV</td>
  78. <td>Initialization vector that is used together with TK.</td>
  79. </tr>
  80. <tr>
  81. <td>Transport Secret</td>
  82. <td>TS</td>
  83. <td>Tuple formed of TK and TI.</td>
  84. </tr>
  85. <tr>
  86. <td>Envelope Element</td>
  87. <td>EE</td>
  88. <td>Output element of an established end-to-end encryption method when encrypting TS.</td>
  89. </tr>
  90. </table>
  91. </section1>
  92. <section1 topic='Principle' anchor='principle'>
  93. <p>Lets assume Romeo wants to initiate an encrypted Jingle session with Juliet. Prior to the Jingle session initiation, an already existing, established and (ideally) authenticated end-to-end encryption session between Romeo and Juliet MUST exist. This session is needed to transfer the Transport Secret from Romeo to Juliet.</p>
  94. <p>When this precondition is met, Romeo initially generates a transport key (TK) and associated initialization vector (IV). These will later be used by the sender to encrypt, and respectively by the recipient to decrypt data that is exchanged. This protocol defines a set of usable <link url='#ciphers'>ciphers</link> from which Romeo might choose. TK and IV together form the transport secret (TS).</p>
  95. <p>Next Romeo uses his established encryption session with Juliet to encrypt TS. The resulting envelope element (EE) will be part of the Jingle session initiation as child of the JET &security;
  96. element.</p>
  97. <p>When Juliet receives Romeos session request, she decrypts EE to retrieve TS, from which she can obtain TK and IV. Now she and Romeo can go on with the session negotiation. Once the session is
  98. established, data can be encrypted and exchanged. Both parties MUST keep a copy of TS in cache until the Jingle session is ended.</p>
  99. </section1>
  100. <section1 topic='Encrypted Jingle File Transfer using JET' anchor='jft'>
  101. <p>&xep0234; has the disadvantage, that transmitted files are not encrypted (aside from regular TLS transport encryption), which means that intermediate nodes like XMPP/proxy server(s) have access to the transferred data. Considering that end-to-end encryption becomes more and more important to protect free speech and personal expression, this is a major flaw that needs to be addressed.</p>
  102. <p>In order to initiate an encrypted file transfer, the initiator includes a JET &security; element in the Jingle file transfer request.</p>
  103. <section2 topic='File Offer'>
  104. <p>In this scenario Romeo wants to send an encrypted text file over to Juliet. First, he generates a fresh AES-256 transport key and IV. In this case TK and IV are serialized into TS which is then encrypted using Romeos end-to-end-encryption session with Juliet.</p>
  105. <p>The resulting envelope element (EE) is sent as part of the security element along with the rest of the jingle stanza over to Juliet.</p>
  106. <example caption="Romeo initiates an encrypted file offer"><![CDATA[
  107. <iq from='romeo@montague.example/dr4hcr0st3lup4c'
  108. id='nzu25s8'
  109. to='juliet@capulet.example/yn0cl4bnw0yr3vym'
  110. type='set'>
  111. <jingle xmlns='urn:xmpp:jingle:1'
  112. action='session-initiate'
  113. initiator='romeo@montague.example/dr4hcr0st3lup4c'
  114. sid='851ba2'>
  115. <content creator='initiator' name='a-file-offer' senders='initiator'>
  116. <description xmlns='urn:xmpp:jingle:apps:file-transfer:5'>
  117. <file>
  118. <date>1969-07-21T02:56:15Z</date>
  119. <desc>This is a test. If this were a real file...</desc>
  120. <media-type>text/plain</media-type>
  121. <name>test.txt</name>
  122. <range/>
  123. <size>6144</size>
  124. <hash xmlns='urn:xmpp:hashes:2'
  125. algo='sha-1'>w0mcJylzCn+AfvuGdqkty2+KP48=</hash>
  126. </file>
  127. </description>
  128. <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
  129. mode='tcp'
  130. sid='vj3hs98y'>
  131. <candidate cid='hft54dqy'
  132. host='192.168.4.1'
  133. jid='romeo@montague.example/dr4hcr0st3lup4c'
  134. port='5086'
  135. priority='8257636'
  136. type='direct'/>
  137. </transport>
  138. <security xmlns='urn:xmpp:jingle:jet:0'
  139. name='a-file-offer'
  140. cipher='urn:xmpp:ciphers:aes-256-gcm-nopadding'
  141. type='urn:xmpp:encryption:stub:0'>
  142. <encrypted xmlns='urn:xmpp:encryption:stub:0'>
  143. <payload>BASE64-ENCODED-ENCRYPTED-SECRET</payload>
  144. </encrypted>
  145. </security>
  146. </content>
  147. </jingle>
  148. </iq>]]></example>
  149. <p>Juliet decrypts the envelope element (EE) using her session with Romeo to retrieve TS from which she deserializes TK and IV. Both Juliet and Romeo then carry on with the session negotiation as described in &xep0234;. Before Romeo starts transmitting the file, he encrypts it using TK and IV. He then transmitts the encrypted file over to Juliet.</p>
  150. <p>When Juliet received the file, she uses the TK and IV to decrypt the received file.</p>
  151. </section2>
  152. <section2 topic='File Request'>
  153. <p>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 generates TK and IV, creates TS from those and encrypts TS with an encryption method of her choice to get EE. TK and IV will be used by Romeo to encrypt the requested file before sending it to Juliet.</p>
  154. <example caption="Juliet initiates an encrypted file request"><![CDATA[
  155. <iq from='juliet@capulet.example/yn0cl4bnw0yr3vym'
  156. id='wsn361c3'
  157. to='romeo@montague.example/dr4hcr0st3lup4c'
  158. type='set'>
  159. <jingle xmlns='urn:xmpp:jingle:1'
  160. action='session-initiate'
  161. initiator='juliet@capulet.example/yn0cl4bnw0yr3vym'
  162. sid='uj3b2'>
  163. <content creator='initiator' name='a-file-request' senders='responder'>
  164. <description xmlns='urn:xmpp:jingle:apps:file-transfer:5'>
  165. <file>
  166. <hash xmlns='urn:xmpp:hashes:2'
  167. algo='sha-1'>w0mcJylzCn+AfvuGdqkty2+KP48=</hash>
  168. </file>
  169. </description>
  170. <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
  171. mode='tcp'
  172. sid='xig361fj'>
  173. <candidate cid='ht567dq'
  174. host='192.169.1.10'
  175. jid='juliet@capulet.example/yn0cl4bnw0yr3vym'
  176. port='6539'
  177. priority='8257636'
  178. type='direct'/>
  179. </transport>
  180. <security xmlns='urn:xmpp:jingle:jet:0'
  181. name='a-file-request'
  182. cipher='urn:xmpp:ciphers:aes-256-gcm-nopadding'
  183. type='urn:xmpp:encryption:stub:0'>
  184. <encrypted xmlns='urn:xmpp:encryption:stub:0'>
  185. <payload>BASE64-ENCODED-ENCRYPTED-SECRET</payload>
  186. </encrypted>
  187. </security>
  188. </content>
  189. </jingle>
  190. </iq>]]></example>
  191. </section2>
  192. <section2 topic='Encrypted Ranged Transfers'>
  193. <p>&xep0234; defines a way for parties to request ranged transfers. This can be used to resume interrupted transfers etc. In case of an interrupted transfer, the receiving party might be able to decrypt parts of the received file. When requesting a resumption of the transfer, the recipient therefore can use the index of the last successfully decrypted byte of the file as offset in the ranged transfer. Since a resumed transfer takes place in a new session, the old transport secret might no longer be available to either party. For that reason the receiver creates a new TS for the session-initiation. The sending party then encrypts and sends only the requested parts of the file.</p>
  194. <example caption="Romeo requests the resumption of an interrupted transfer using a fresh transport secret"><![CDATA[
  195. <iq from='romeo@montague.example/dr4hcr0st3lup4c'
  196. id='wsn361c3'
  197. to='juliet@capulet.example/yn0cl4bnw0yr3vym'
  198. type='set'>
  199. <jingle xmlns='urn:xmpp:jingle:1'
  200. action='session-initiate'
  201. initiator='romeo@montague.example/dr4hcr0st3lup4c'
  202. sid='uj3b2'>
  203. <content creator='initiator' name='restart' senders='responder'>
  204. <description xmlns='urn:xmpp:jingle:apps:file-transfer:5'>
  205. <file>
  206. <range offset='270336'/>
  207. <hash xmlns='urn:xmpp:hashes:2'
  208. algo='sha-1'>w0mcJylzCn+AfvuGdqkty2+KP48=</hash>
  209. </file>
  210. </description>
  211. <transport xmlns='urn:xmpp:jingle:transports:s5b:1'
  212. mode='tcp'
  213. sid='vj3hs98y'>
  214. <candidate cid='hft54dqy'
  215. host='192.168.4.1'
  216. jid='romeo@montague.example/dr4hcr0st3lup4c'
  217. port='5086'
  218. priority='8257636'
  219. type='direct'/>
  220. <candidate cid='hutr46fe'
  221. host='24.24.24.1'
  222. jid='romeo@montague.example/dr4hcr0st3lup4c'
  223. port='5087'
  224. priority='8258636'
  225. type='direct'/>
  226. </transport>
  227. <security xmlns='urn:xmpp:jingle:jet:0'
  228. name='restart'
  229. cipher='urn:xmpp:ciphers:aes-256-gcm-nopadding'
  230. type='urn:xmpp:encryption:stub:0'>
  231. <encrypted xmlns='urn:xmpp:encryption:stub:0'>
  232. <payload>BASE64-ENCODED-ENCRYPTED-SECRET</payload>
  233. </encrypted>
  234. </security>
  235. </content>
  236. </jingle>
  237. </iq>]]></example>
  238. </section2>
  239. </section1>
  240. <section1 topic='Ciphers' anchor='ciphers'>
  241. <p>In order to encrypt the transported bytestream, the initiator must transmit a cipher key to the responder. There are multiple options available:</p>
  242. <table caption='Available ciphers, configurations and their namespaces'>
  243. <tr>
  244. <th>Namespace</th>
  245. <th>Type</th>
  246. <th>Length (bits)</th>
  247. <th>Parameters</th>
  248. </tr>
  249. <tr>
  250. <td>urn:xmpp:ciphers:aes-128-gcm-nopadding:0</td>
  251. <td>AES</td>
  252. <td>Key: 128, IV: 96</td>
  253. <td>GCM/NoPadding</td>
  254. </tr>
  255. <tr>
  256. <td>urn:xmpp:ciphers:aes-256-gcm-nopadding:0</td>
  257. <td>AES</td>
  258. <td>Key: 256, IV: 96</td>
  259. <td>GCM/NoPadding</td>
  260. </tr>
  261. </table>
  262. </section1>
  263. <section1 topic='Determining Support' anchor='support'>
  264. <p>To advertise its support for the Jingle Encrypted Transports, when replying to service discovery information ("disco#info") requests an entity MUST return URNs for any version, or extension of this protocol that the entity supports -- e.g., "urn:xmpp:jingle:jet:0" for this version, or "urn:xmpp:jingle:jet-stub:0" for a stub encryption method &VNOTE;.</p>
  265. <example caption="Service discovery information request"><![CDATA[
  266. <iq from='romeo@montague.example/dr4hcr0st3lup4c'
  267. id='uw72g176'
  268. to='juliet@capulet.example/yn0cl4bnw0yr3vym'
  269. type='get'>
  270. <query xmlns='http://jabber.org/protocol/disco#info'/>
  271. </iq>]]></example>
  272. <example caption="Service discovery information response"><![CDATA[
  273. <iq from='juliet@capulet.example/yn0cl4bnw0yr3vym'
  274. id='uw72g176'
  275. to='romeo@montague.example/dr4hcr0st3lup4c'
  276. type='result'>
  277. <query xmlns='http://jabber.org/protocol/disco#info'>
  278. <feature var='urn:xmpp:jingle:jet:0'/>
  279. <feature var='urn:xmpp:jingle:jet-stub:0'/>
  280. </query>
  281. </iq>]]></example>
  282. <p>In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
  283. </section1>
  284. <section1 topic='Security Considerations' anchor='security'>
  285. <p>The initiator SHOULD NOT use the generated key TK as IV, but instead generate a seperate random IV.</p>
  286. <p>Instead of falling back to unencrypted transfer in case something goes wrong, implementations MUST instead abort the Jingle session, informing the user.</p>
  287. <p>IMPORTANT: This approach does not deal with metadata. In case of &xep0234;, an attacker with access to the sent stanzas can for example still see the name of the file and other information included in the &lt;file/&gt; element.</p>
  288. <p>The responder MUST check, whether the envelope element belongs to the initiator to prevent MitM attacks</p>
  289. </section1>
  290. <section1 topic='Acknowledgements' anchor='acknowledgements'>
  291. <p>Big thanks to Florian Schmaus for mentoring my Google Summer of Code project, which resulted in this protocol. Also thanks to Andrey Gursky, Daniel Gultsch, Dave Cridland, Goffi, Jonas Wielicki and Sam Whited for their input and feedback.</p>
  292. </section1>
  293. </xep>