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-0241.xml 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Encryption of Archived Messages</title>
  10. <abstract>This specification defines methods for encrypting messages that are archived at an XMPP server.</abstract>
  11. &LEGALNOTICE;
  12. <number>0241</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <dependencies>
  17. <spec>XMPP Core</spec>
  18. <spec>XEP-0136</spec>
  19. <spec>W3C XML Encryption</spec>
  20. <spec>W3C XML Signature</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>NOT_YET_ASSIGNED</shortname>
  25. &ianpaterson;
  26. <revision>
  27. <version>0.1</version>
  28. <date>2008-04-30</date>
  29. <initials>psa</initials>
  30. <remark><p>Initial version, split off from XEP-0136 per XMPP Council consensus.</p></remark>
  31. </revision>
  32. </header>
  33. <section1 topic='Introduction' anchor='intro'>
  34. <p>&xep0136; defines a technology for archiving messages at an XMPP server instead of locally on a client device. This specification defines methods for encrypting such messages.</p>
  35. </section1>
  36. <section1 topic='Encryption of Manually-Archived Collections' anchor='manual'>
  37. <p>Clients SHOULD encrypt manually-archived collections (although early implementations of this protocol MAY prefer to defer encryption and decryption to later releases). Servers MUST support the manual-archiving of encrypted collections.</p>
  38. <p>Before uploading a sequence of messages to a collection, the client SHOULD select a symmetric data encryption algorithm, generate a suitable random encryption key, give the key a unique (for the user) name, encrypt the symmetric key with one of the user's public keys, and wrap the result inside one or more &lt;EncryptedKey/&gt; elements, as specified in &w3xmlenc;.</p>
  39. <p>To ensure that all its user's clients will be able to decrypt the collection, the client SHOULD create one &lt;EncryptedKey/&gt; element for each of its user's public keys that are being published using &xep0189;. However, the client MUST NOT create an &lt;EncryptedKey/&gt; element for any public key until it has confirmed that it belongs to the user. Note: The fact that a public key is being published using <cite>XEP-0189</cite> is <em>not</em> sufficient proof of ownership, since the user's server may have been compromised at some stage. The method of confirmation is beyond the scope of this document.</p>
  40. <p>The client SHOULD use the symmetric key to encrypt the joined sequence of &lt;to/&gt;, &lt;from/&gt; and &lt;note/&gt; elements, base64 encode the resulting sequence of bytes, and wrap it inside an &lt;EncryptedData/&gt; element, as described in <cite>XML Encryption</cite>.</p>
  41. <p>Clients may add one or more &lt;EncryptedData/&gt; or &lt;EncryptedKey/&gt; elements to a collection using exactly the same method as for &lt;to/&gt;, &lt;from/&gt; and &lt;note/&gt; elements (see <link url='#manual-upload'>Uploading Messages to a Collection</link>). One collection may contain &lt;EncryptedData/&gt; elements encrypted with different symmetric keys.</p>
  42. <p>When appending &lt;EncryptedData/&gt; elements to a collection, the client MAY reuse a symmetric Key that has already been uploaded to the collection. In this case the client SHOULD NOT resend &lt;EncryptedKey/&gt; elements.</p>
  43. <p>Note: A collection that contains &lt;EncryptedData/&gt; or &lt;EncryptedKey/&gt; elements MUST NOT contain &lt;to/&gt; or &lt;from/&gt; or &lt;note/&gt; elements.</p>
  44. <example caption='Storing encrypted messages and keys in a collection'><![CDATA[
  45. <iq type='set' id='crypt1'>
  46. <save xmlns='urn:xmpp:tmp:archive'>
  47. <chat with='juliet@capulet.com/chamber'
  48. start='1469-07-23T19:22:31Z'
  49. subject='She speaks!'>
  50. <EncryptedData xmlns='http://www.w3.org/2001/04/xmlenc#'
  51. Type='http://www.w3.org/2001/04/xmlenc#Content'>
  52. <EncryptionMethod Algorithm='http://www.w3.org/2001/04/xmlenc#aes128-cbc'/>
  53. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  54. <KeyName>dataKey1</KeyName>
  55. </KeyInfo>
  56. <CipherData><CipherValue>+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ</CipherValue></CipherData>
  57. </EncryptedData>
  58. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  59. <CarriedKeyName>dataKey1</CarriedKeyName>
  60. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  61. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  62. <KeyName>romeoPublicKey1fingerprint</KeyName>
  63. </KeyInfo>
  64. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  65. </EncryptedKey>
  66. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  67. <CarriedKeyName>dataKey1</CarriedKeyName>
  68. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  69. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  70. <KeyName>romeoPublicKey2fingerprint</KeyName>
  71. </KeyInfo>
  72. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  73. </EncryptedKey>
  74. </chat>
  75. </save>
  76. </iq>
  77. ]]></example>
  78. <p>The &lt;CipherData/&gt; child of each &lt;EncryptedData/&gt; element contains the base64-encoded symmetric-encrypted messages. The &lt;EncryptionMethod/&gt; and &lt;KeyInfo/&gt; children specify the symmetric encryption algorithm and the name of the symmetric key used to encrypt the messages.</p>
  79. <p>The &lt;CarriedKeyName/&gt; child of each &lt;EncryptedKey/&gt; element contains the name of the symmetric key it contains. The name is referenced by the &lt;KeyName/&gt; child of the &lt;KeyInfo/&gt; child of an &lt;EncryptedData/&gt; element. The &lt;CipherData/&gt; child of each &lt;EncryptedKey/&gt; element contains the base64-encoded public-key-encrypted symmetric key. The &lt;EncryptionMethod/&gt; and &lt;KeyInfo/&gt; children specify the public key encryption algorithm and the name of the public key used to encrypt the symmetric key. The name of the public key MAY refer to the name in the &lt;KeyName/&gt; child of one of the &lt;KeyInfo/&gt; elements that are being published using <cite>XEP-0189</cite>.</p>
  80. <example caption='Private chat with encrypted attributes form'><![CDATA[
  81. <iq type='set' id='form2'>
  82. <save xmlns='urn:xmpp:tmp:archive'>
  83. <chat with='benvolio@montague.net'
  84. start='1469-07-21T03:01:54Z'>
  85. <x xmlns='jabber:x:data' type='submit'>
  86. <EncryptedData xmlns='http://www.w3.org/2001/04/xmlenc#'
  87. Type='http://www.w3.org/2001/04/xmlenc#Content'>
  88. <EncryptionMethod Algorithm='http://www.w3.org/2001/04/xmlenc#aes128-cbc'/>
  89. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  90. <KeyName>dataKey1</KeyName>
  91. </KeyInfo>
  92. <CipherData><CipherValue>+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ</CipherValue></CipherData>
  93. </EncryptedData>
  94. </x>
  95. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  96. <CarriedKeyName>dataKey1</CarriedKeyName>
  97. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  98. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  99. <KeyName>romeoPublicKey1fingerprint</KeyName>
  100. </KeyInfo>
  101. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  102. </EncryptedKey>
  103. </chat>
  104. </save>
  105. </iq>
  106. ]]></example>
  107. <p>The x:data form MAY be removed from a collection simply by uploading an empty form. Note: The server SHOULD NOT return an error if it finds that the form to be deleted does not exist.</p>
  108. <example caption='Deleting the attributes form'><![CDATA[
  109. <iq type='set' id='form3'>
  110. <save xmlns='urn:xmpp:tmp:archive'>
  111. <chat with='benvolio@montague.net'
  112. start='1469-07-21T03:01:54Z'>
  113. <x xmlns='jabber:x:data' type='submit'/>
  114. </chat>
  115. </save>
  116. </iq>
  117. ]]></example>
  118. </section1>
  119. <section1 topic='Enabling Auto-Archiving with Encryption' anchor='auto'>
  120. <p>The client can enable auto-archiving with server-side encryption by setting the 'save' attribute to "true" or "1" and setting the 'encrypt' attribute to "true" or "1".</p>
  121. <example caption='Client enables auto archiving with encryption'><![CDATA[
  122. <iq type='set' id='auto2'>
  123. <auto encrypt='true' save='true' xmlns='urn:xmpp:tmp:archive'/>
  124. </iq>
  125. ]]></example>
  126. <p>If the server does not support encryption but the client attempts to enable encryption, the server MUST return a &feature; error.</p>
  127. <example caption='Server Does Not Support Encrypted Messages'><![CDATA[
  128. <iq type='error' id='auto2'>
  129. <error type='cancel'>
  130. <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  131. </error>
  132. </iq>
  133. ]]></example>
  134. <p>If the server supports encryption but there is no public key available for the user (e.g., as published via &xep0189;, the server MUST return a &notacceptable; error.</p>
  135. <example caption='No Public Key Available'><![CDATA[
  136. <iq type='error' id='auto2'>
  137. <error type='modify'>
  138. <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  139. </error>
  140. </iq>
  141. ]]></example>
  142. <p>If the server supports encryption (see <link url='#disco'>Determining Server Support</link>), it MUST encrypt all the messages that it archives automatically (including any message collections that are currently being recorded) by following exactly the same procedure as clients use when manually archiving collections (see <link url='#crypt'>Encryption</link>).</p>
  143. <p>The client MAY also specify one or more public keys (in addition to any public keys that the user may be publishing using <cite>XEP-0189</cite>). The server MUST use them all to encrypt all the symmetric keys it generates and add these to the collection wrapped in &lt;EncryptedKey/&gt; elements.</p>
  144. <example caption='Client enables auto archiving with encryption'><![CDATA[
  145. <iq type='set' id='auto2'>
  146. <auto save='true'
  147. encrypt='true'
  148. xmlns='urn:xmpp:tmp:archive'>
  149. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  150. <KeyValue>
  151. <KeyName>romeoPublicKey3fingerprint</KeyName>
  152. <RSAKeyValue>
  153. <Modulus>xA7SEU+e0yQH5rm9kbCDN9o3aPIo7HbP7tX6WOocLZAtNfyxSZDU16ksL6W
  154. jubafOqNEpcwR3RdFsT7bCqnXPBe5ELh5u4VEy19MzxkXRgrMvavzyBpVRgBUwUlV
  155. 5foK5hhmbktQhyNdy/6LpQRhDUDsTvK+g9Ucj47es9AQJ3U=
  156. </Modulus>
  157. <Exponent>AQAB</Exponent>
  158. </RSAKeyValue>
  159. </KeyValue>
  160. </KeyInfo>
  161. </auto>
  162. </iq>
  163. ]]></example>
  164. <p>As soon as the server has finished archiving a collection, it MUST securely destroy all copies of the symmetric key it used to encrypt the messages. Note: If the security of the server is compromised, then only the collections being recorded during the attack will be revealed (i.e. only those messages that would have been compromised even if they had not been archived).</p>
  165. </section1>
  166. <section1 topic='Retrieving a List of Encrypted Collections' anchor='collection'>
  167. <p>If a collection contains &lt;EncryptedData/&gt; or &lt;EncryptedKey/&gt; elements then the 'crypt' attribute of the &lt;chat/&gt; element MUST be set to 'true':</p>
  168. <example caption='Receiving the first page of a list'><![CDATA[
  169. <iq type='result' to='romeo@montague.net/orchard' id='list1'>
  170. <list xmlns='urn:xmpp:tmp:archive'>
  171. <chat with='juliet@capulet.com/chamber'
  172. start='1469-07-21T02:56:15Z'
  173. subject='She speaks!'
  174. crypt='true'
  175. version='0'/>
  176. .
  177. [28 more collections]
  178. .
  179. <chat with='balcony@house.capulet.com'
  180. start='1469-07-21T03:16:37Z'
  181. version='4'/>
  182. <set xmlns='http://jabber.org/protocol/rsm'>
  183. <first index='0'>1469-07-21T02:56:15Zjuliet@capulet.com</first>
  184. <last>1469-07-21T03:16:37Zbalcony@house.capulet.com</last>
  185. <count>1372</count>
  186. </set>
  187. </list>
  188. </iq>
  189. ]]></example>
  190. </section1>
  191. <section1 topic='Retrieving an Encrypted Collection' anchor='retrieve'>
  192. <p>The items in encrypted collections are typically larger than the items in an unencrypted collection, since each &lt;EncryptedData/&gt; element typically contains many messages. So the client SHOULD take even more care not to request a page of &lt;EncryptedData/&gt; elements that is so big it might exceed rate limiting restrictions.</p>
  193. <example caption='Requesting the first page of an encrypted collection with all versions of keys'><![CDATA[
  194. <iq type='get' id='page1'>
  195. <retrieve xmlns='urn:xmpp:tmp:archive'
  196. with='juliet@capulet.com/chamber'
  197. start='1469-07-23T19:22:31Z'
  198. <set xmlns='http://jabber.org/protocol/rsm'>
  199. <max>5</max>
  200. </set>
  201. </retrieve>
  202. </iq>
  203. ]]></example>
  204. <p>In addition to the requested &lt;EncryptedData/&gt; elements, the server MUST return all the &lt;EncryptedKey/&gt; elements that it possesses for the user whose symmetric key name (wrapped in its &lt;CarriedKeyName/&gt; child) is referenced by the &lt;KeyName/&gt; child of the &lt;KeyInfo/&gt; child of any of the &lt;EncryptedData/&gt; elements in the returned page.</p>
  205. <example caption='Receiving the first page of an encrypted collection'><![CDATA[
  206. <iq type='result' to='romeo@montague.net/orchard' id='page1'>
  207. <chat xmlns='urn:xmpp:tmp:archive'
  208. with='juliet@capulet.com/chamber'
  209. start='1469-07-23T19:22:31Z'
  210. subject='She speaks!'
  211. version='5'>
  212. <EncryptedData xmlns='http://www.w3.org/2001/04/xmlenc#'
  213. Type='http://www.w3.org/2001/04/xmlenc#Content'>
  214. <EncryptionMethod Algorithm='http://www.w3.org/2001/04/xmlenc#aes128-cbc'/>
  215. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  216. <KeyName>dataKey1</KeyName>
  217. </KeyInfo>
  218. <CipherData><CipherValue>+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ</CipherValue></CipherData>
  219. </EncryptedData>
  220. .
  221. [3 more <EncryptedData/> elements]
  222. .
  223. <EncryptedData xmlns='http://www.w3.org/2001/04/xmlenc#'
  224. Type='http://www.w3.org/2001/04/xmlenc#Content'>
  225. <EncryptionMethod Algorithm='http://www.w3.org/2001/04/xmlenc#aes128-cbc'/>
  226. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  227. <KeyName>dataKey2</KeyName>
  228. </KeyInfo>
  229. <CipherData><CipherValue>+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ</CipherValue></CipherData>
  230. </EncryptedData>
  231. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  232. <CarriedKeyName>dataKey1</CarriedKeyName>
  233. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  234. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  235. <KeyName>romeoPublicKey1fingerprint</KeyName>
  236. </KeyInfo>
  237. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  238. </EncryptedKey>
  239. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  240. <CarriedKeyName>dataKey1</CarriedKeyName>
  241. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  242. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  243. <KeyName>romeoPublicKey2fingerprint</KeyName>
  244. </KeyInfo>
  245. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  246. </EncryptedKey>
  247. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  248. <CarriedKeyName>dataKey2</CarriedKeyName>
  249. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  250. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  251. <KeyName>romeoPublicKey1fingerprint</KeyName>
  252. </KeyInfo>
  253. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  254. </EncryptedKey>
  255. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  256. <CarriedKeyName>dataKey2</CarriedKeyName>
  257. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  258. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  259. <KeyName>romeoPublicKey2fingerprint</KeyName>
  260. </KeyInfo>
  261. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  262. </EncryptedKey>
  263. <set xmlns='http://jabber.org/protocol/rsm'>
  264. <first index='0'>0</first>
  265. <last>4</last>
  266. <count>7</count>
  267. </set>
  268. </chat>
  269. </iq>
  270. ]]></example>
  271. <p>The client MAY limit the number of &lt;EncryptedKey/&gt; elements that it receives by specifying the name of one or more public keys for which it holds the associated private keys. The name of each public key MUST be wrapped in a &lt;KeyName/&gt; element.</p>
  272. <example caption='Requesting the first page of an encrypted collection with specified version of keys'><![CDATA[
  273. <iq type='get' id='page1'>
  274. <retrieve xmlns='urn:xmpp:tmp:archive'
  275. with='juliet@capulet.com/chamber'
  276. start='1469-07-23T19:22:31Z'>
  277. <KeyName xmlns='http://www.w3.org/2000/09/xmldsig#'>romeoPublicKey1fingerprint</KeyName>
  278. <set xmlns='http://jabber.org/protocol/rsm'>
  279. <max>1</max>
  280. </set>
  281. </retrieve>
  282. </iq>
  283. ]]></example>
  284. <p>If the request includes one or more &lt;KeyName/&gt; elements then the server MUST only return those &lt;EncryptedKey/&gt; elements whose public key name (wrapped in the &lt;KeyName/&gt; child of the &lt;KeyInfo/&gt; child) is specified in the request.</p>
  285. </section1>
  286. <section1 topic='Replacing EncryptedKey Elements' anchor='rekey'>
  287. <p>If a private key becomes obsolete or compromised then it may be necessary for a client to replace all &lt;EncryptedKey/&gt; elements that contain symmetric keys encrypted with the public key that is associated with the obsolete private key.</p>
  288. <p>The client first requests a list of the affected &lt;EncryptedKey/&gt; elements from all collections by sending a &lt;keys/&gt; element to the server:</p>
  289. <example caption='Requesting the first page of a list of keys'><![CDATA[
  290. <iq type='get' id='pubkey1'>
  291. <keys xmlns='urn:xmpp:tmp:archive'>
  292. <KeyName xmlns='http://www.w3.org/2000/09/xmldsig#'>romeoPublicKey1fingerprint</KeyName>
  293. <set xmlns='http://jabber.org/protocol/rsm'>
  294. <max>50</max>
  295. </set>
  296. </keys>
  297. </iq>
  298. ]]></example>
  299. <p>The server MUST return only &lt;EncryptedKey/&gt; elements whose symmetric encryption key is encrypted with the obsolete public key specified in the &lt;KeyName/&gt; child of the request:</p>
  300. <example caption='Receiving the first page of a list of keys'><![CDATA[
  301. <iq type='result' to='romeo@montague.net/orchard' id='pubkey1'>
  302. <keys xmlns='urn:xmpp:tmp:archive'>
  303. <chat with='juliet@capulet.com/chamber'
  304. start='1469-07-23T19:22:31Z'
  305. version='6'>
  306. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  307. <CarriedKeyName>dataKey1</CarriedKeyName>
  308. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  309. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  310. <KeyName>romeoPublicKey1fingerprint</KeyName>
  311. </KeyInfo>
  312. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  313. </EncryptedKey>
  314. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  315. <CarriedKeyName>dataKey2</CarriedKeyName>
  316. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  317. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  318. <KeyName>romeoPublicKey1fingerprint</KeyName>
  319. </KeyInfo>
  320. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  321. </EncryptedKey>
  322. </chat>
  323. .
  324. [49 more sets of collection keys]
  325. .
  326. <set xmlns='http://jabber.org/protocol/rsm'>
  327. <first index='0'>1469-07-23T19:22:31Zjuliet@capulet.com</first>
  328. <last>1469-08-03T13:24:06Zbalcony@house.capulet.com</last>
  329. <count>3810</count>
  330. </set>
  331. </keys>
  332. </iq>
  333. ]]></example>
  334. <p>The client decrypts each symmetric key with the obsolete private key and encrypts it again with the new public key. The client then wraps each symmetric key in an &lt;EncryptedKey/&gt; element and asks the server to archive it in its associated collection on the server (see <link url='#crypt'>Encryption</link>):</p>
  335. <example caption='Storing encrypted keys in a collection'><![CDATA[
  336. <iq type='set' id='crypt1'>
  337. <save xmlns='urn:xmpp:tmp:archive'>
  338. <chat with='juliet@capulet.com/chamber'
  339. start='1469-07-23T19:22:31Z'>
  340. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  341. <CarriedKeyName>dataKey1</CarriedKeyName>
  342. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  343. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  344. <KeyName>romeoPublicKey2fingerprint</KeyName>
  345. </KeyInfo>
  346. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  347. </EncryptedKey>
  348. <EncryptedKey xmlns='http://www.w3.org/2001/04/xmlenc#'>
  349. <CarriedKeyName>dataKey2</CarriedKeyName>
  350. <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
  351. <KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
  352. <KeyName>romeoPublicKey2fingerprint</KeyName>
  353. </KeyInfo>
  354. <CipherData><CipherValue>E5Qbvfa2gI5lBZMAHryv4g</CipherValue></CipherData>
  355. </EncryptedKey>
  356. </chat>
  357. </save>
  358. </iq>
  359. .
  360. [49 more sets of collection keys]
  361. .
  362. ]]></example>
  363. <p>Finally, the client asks the server to delete from each collection all &lt;EncryptedKey/&gt; elements whose symmetric encryption key is encrypted with the obsolete public key:</p>
  364. <example caption='Deleting key(s) from a collection'><![CDATA[
  365. <iq type='get' id='delete1'>
  366. <delete xmlns='urn:xmpp:tmp:archive'
  367. with='juliet@capulet.com/chamber'
  368. start='1469-07-23T19:22:31Z'>
  369. <KeyName xmlns='http://www.w3.org/2000/09/xmldsig#'>romeoPublicKey1fingerprint</KeyName>
  370. </delete>
  371. </iq>
  372. .
  373. [49 more delete requests]
  374. .
  375. ]]></example>
  376. </section1>
  377. <section1 topic='Determining Server Support' anchor='disco'>
  378. <p>A client discovers whether its server supports this protocol using &xep0030;.</p>
  379. <example caption='Client Service Discovery request'>
  380. <![CDATA[
  381. <iq from='romeo@montague.net/orchard'
  382. id='disco1'
  383. to='montague.net'
  384. type='get'>
  385. <query xmlns='http://jabber.org/protocol/disco#info'/>
  386. </iq>
  387. ]]></example>
  388. <p>If the server supports the <em>service-side</em> encryption feature, it MUST return a &lt;feature/&gt; element with the 'var' attribute set to 'urn:xmpp:tmp:archive:encrypt' &NSNOTE;.</p>
  389. <example caption='Server Service Discovery response'>
  390. <![CDATA[
  391. <iq from='montague.net'
  392. id='disco1'
  393. to='romeo@montague.net/orchard'
  394. type='get'>
  395. <query xmlns='http://jabber.org/protocol/disco#info'/>
  396. ...
  397. <feature var='urn:xmpp:tmp:archive:encrypt'/>
  398. ...
  399. </query>
  400. </iq>
  401. ]]></example>
  402. </section1>
  403. <section1 topic='Security Considerations' anchor='security'>
  404. <p>Because the subject of each collection will not be encrypted even if its messages are encrypted, the client MUST warn its human user (if any) before including 'subject' attributes on encrypted collections.</p>
  405. </section1>
  406. <section1 topic='IANA Considerations' anchor='iana'>
  407. <p>No interaction with &IANA; is required as a result of this document.</p>
  408. </section1>
  409. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  410. <section2 topic='Service Discovery Features' anchor='registrar-features'>
  411. <p>The XMPP Registrar shall include the following features in its registry of service discovery features (see &DISCOFEATURES;), where the string "urn:xmpp:tmp:archive" shall be replaced with the URN issued by the XMPP Registrar:</p>
  412. <ul>
  413. <li>urn:xmpp:tmp:archive:encrypt</li>
  414. </ul>
  415. </section2>
  416. </section1>
  417. <section1 topic='XML Schema' anchor='schema'>
  418. <p>If this specification is advanced to a status of Draft, the schema for the 'urn:xmpp:tmp:archive' namespace &NSNOTE; shall be updated to add a boolean 'encrypt' attribute to the &lt;auto/&gt; element, as follows.</p>
  419. <code><![CDATA[
  420. <xs:element name='auto'>
  421. <xs:complexType>
  422. <xs:sequence>
  423. <xs:any processContents='lax' namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
  424. </xs:sequence>
  425. <xs:attribute name='encrypt' type='xs:boolean' use='optional'/>
  426. <xs:attribute name='save' type='xs:boolean' use='required'/>
  427. </xs:complexType>
  428. </xs:element>
  429. ]]></code>
  430. </section1>
  431. </xep>