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.

314 lines
16KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM '../xep.dtd' [
  3. <!ENTITY % ents SYSTEM '../xep.ent'>
  4. <!ENTITY BASE64 "<span class='ref'><link url='http://tools.ietf.org/html/rfc4648'>BASE64</link></span> <note>RFC 4648: The Base16, Base32, and Base64 Data &lt;<link url='http://tools.ietf.org/html/rfc4648'>http://tools.ietf.org/html/rfc4648</link>&gt;.</note>" >
  5. <!ENTITY DATETIME "<span class='ref'><link url='http://tools.ietf.org/html/rfc3339'>DATETIME</link></span> <note>RFC 3339: Date and Time on the Internet Timestamps &lt;<link url='http://tools.ietf.org/html/rfc3339'>http://tools.ietf.org/html/rfc3339</link>&gt;.</note>" >
  6. <!ENTITY XMLDSIG "<span class='ref'><link url='http://www.w3.org/TR/xmldsig-core/'>XMLDSIG</link></span> <note>XML Signature Syntax and Processing, W3C Recommendation, 10 June 2008 &lt;<link url='http://www.w3.org/TR/xmldsig-core/'>http://www.w3.org/TR/xmldsig-core/</link>&gt;.</note>" >
  7. <!ENTITY E2EEncrypt "<span class='ref'><link url='http://datatracker.ietf.org/doc/draft-miller-3923bis'>E2EEncrypt</link></span> <note>End-to-End Object Encryption for the Extensible Messaging and Presence Protocol (XMPP), Miller, M. and P. Saint-Andre, work in progress &lt;<link url='http://datatracker.ietf.org/doc/draft-miller-3923bis'>http://datatracker.ietf.org/doc/draft-miller-3923bis</link>&gt;.</note>" >
  8. %ents;
  9. ]>
  10. <?xml-stylesheet type='text/xsl' href='../xep.xsl'?>
  11. <xep>
  12. <header>
  13. <title>Digital Signatures in XMPP</title>
  14. <abstract>This document provides a technical specification for Digital Signatures in the
  15. Extensible Messaging and Presence Protocol (XMPP).</abstract> &LEGALNOTICE;
  16. <number>XXXX</number>
  17. <status>Proto</status>
  18. <type>Technical Specification</type>
  19. <sig>Standards</sig>
  20. <approver>Council</approver>
  21. <dependencies>
  22. <spec>XMPP Core</spec>
  23. <spec>XEP-0001</spec>
  24. </dependencies>
  25. <supersedes/>
  26. <supersededby/>
  27. <shortname>N/A</shortname> &kdz; <revision>
  28. <version>0.0</version>
  29. <date>2010-03-10</date>
  30. <initials>kdz</initials>
  31. <remark>
  32. <p>Proto-XEP draft.</p>
  33. </remark>
  34. </revision>
  35. </header>
  36. <section1 topic="Introduction" anchor="intro">
  37. <p>This document provides a technical specification for Digital Signatures in Extensible
  38. Messaging and Presence Protocol (&xmpp;) based upon End-to-End Object Encryption
  39. (&E2EEncrypt;) "work in progress".</p>
  40. <p>The S/MIME approach defined in &rfc3923; has never been implemented in XMPP clients to the
  41. best of our knowledge, but has some attractive features, especially the ability to
  42. store-and-forward a signed message at a user's server if the user is not online when the
  43. message is received (in the XMPP community this is called "offline storage" and the message is
  44. referred to as an "offline message"). The authors surmise that RFC 3923 has not been
  45. implemented mainly because it adds several new dependencies to XMPP clients, especially MIME
  46. (along with the CPIM and MSGFMT media types). This document explores the possibility of an
  47. approach that is similar to but simpler than RFC 3923.</p>
  48. </section1>
  49. <section1 topic="Signing XMPP Stanzas" anchor="stanza">
  50. <p>The process that a sending agent follows for securing stanzas is very similar regardless of
  51. the form of stanza (i.e., &lt;iq/&gt;, &lt;message/&gt;, or &lt;presence/&gt;).</p>
  52. <ol>
  53. <li>Constructs a cleartext version of the stanza, S.</li>
  54. <li>Notes the current UTC date and time N when this stanza is constructed, formatted as
  55. described in Section 5.</li>
  56. <li>Converts the stanza to a UTF-8, as defined by &rfc3629;, encoded string, optionally
  57. removing line breaks and other insignificant whitespace between elements and attributes,
  58. i.e., UTF8-encode(S) = S'. We call S' a "stanza-string" because for purposes of signing and
  59. verification it is treated not as XML but as an opaque string (this avoids the need for
  60. complex canonicalization of the XML input).</li>
  61. <li>Constructs a plaintext envelope (E) &lt;plain/&gt; qualified by the "urn:xmpp:signed:0"
  62. namespace as follows: <ul>
  63. <li>The attribute 'timestamp' set to the UTC date and time value N</li>
  64. <li>The XML character data set to the base64-encoded form of S' (where the encoding
  65. adheres to the definition in Section 4 of &BASE64; and where the padding bits are set to
  66. zero). This encoding is necessary to preserve a canonicalized form of S'.</li>
  67. </ul>
  68. </li>
  69. <li>Converts the envelope (E) to a UTF-8 encoded string, optionally removing line breaks and
  70. other insignificant whitespace between elements and attributes, i.e., E' =
  71. UTF8-encode(E).</li>
  72. <li>Produce a signature of UTF8-encoded envelope (E') using the intended signature algorithm.
  73. T = signature(E'). (This step is underspecified and will be expanded upon in later revision
  74. of this document.)</li>
  75. <li>Base64-encodes T to produce the signature data T'.</li>
  76. <li>Constructs an &lt;signed/&gt; element qualified by the "urn:xmpp:signed:0" namespace as
  77. follows: <ul>
  78. <li>The child element &lt;signature&gt; (implicitly qualified by the "urn:xmpp:signed:0"
  79. namespace) as follows: <ul>
  80. <li>The attribute 'algorithm' set to a string identifying the signature algorithm
  81. used.</li>
  82. <li>The XML character data T'.</li>
  83. </ul></li>
  84. <li>The child element &lt;data&gt; (implicitly qualified by the "urn:xmpp:signed:0"
  85. namespace) as follows: <ul>
  86. <li>The XML character data E'.</li>
  87. </ul>
  88. </li>
  89. </ul>
  90. </li>
  91. <li>Sends the &lt;signed&gt; element as the payload of a stanza that SHOULD match the stanza
  92. from step 1 in kind (e.g., &lt;message/&gt;), type (e.g., "chat"), and addressing (e.g.
  93. to="romeo@montague.net" from="juliet@capulet.net/balcony"). If the original stanza (S) has a
  94. value for the "id" attribute, this stanza MUST NOT use the same value for its "id"
  95. attribute.</li>
  96. </ol>
  97. <section2 topic="Example of Signing Messages" anchor="ex-message">
  98. <p>The sender begins with the cleartext version of the &lt;message/&gt; stanza "S":</p>
  99. <example><![CDATA[
  100. <message xmlns='jabber:client'
  101. from='juliet@capulet.net/balcony'
  102. id='183ef129'
  103. to='romeo@montague.net'
  104. type='chat'>
  105. <thread>8996aef0-061d-012d-347a-549a200771aa</thread>
  106. <body>Wherefore art thou, Romeo?</body>
  107. </message>
  108. ]]></example>
  109. <p>The sender then performs the steps 1 through 4 from above to generate:</p>
  110. <example><![CDATA[
  111. <plain xmlns="urn:xmpp:signed:0"
  112. timestamp="2010-06-29T02:15:21.012Z">
  113. PG1lc3NhZ2UgeG1sbnM9ImphYmJlcjpjbGllbnQiIGZyb209Imp1bGlldEBjYXB
  114. 1bGV0Lm5ldC9iYWxjb255IiB0bz0icm9tZW9AbW9udGVndWUubmV0IiB0eXBlPS
  115. JjaGF0Ij48dGhyZWFkPmM2MzczODI0LWEzMDctNDBkZC04ZmUwLWJhZDZlNzI5O
  116. WFkMDwvdGhyZWFkPjxib2R5PldoZXJlZm9yZSBhcnQgdGhvdSwgUm9tZW8/PC9i
  117. b2R5PjwvbWVzc2FnZT4=
  118. </plain>
  119. ]]></example>
  120. <p>And then performs steps 5 through 9 steps, causing the following to be sent:</p>
  121. <example><![CDATA[
  122. <message xmlns='jabber:client'
  123. from='juliet@capulet.net/balcony'
  124. id='6410ed123'
  125. to='romeo@montague.net'
  126. type='chat'>
  127. <signed xmlns="urn:xmpp:signed:0">
  128. <signature algorithm="RSA-SHA1">
  129. DxbxIziY1C1Ytcxkj0IFLsfmDLMv96JMlMAQZ7jh49IbsOIPsxI2LyLmqhKH/994UXDJKQLHvLJz
  130. gAmw8V2b+zmyZeItJzSmB+HHiLFVXkD2Dd4JfetsafsfIcB7uNWg0gAeiKrTHfFgiyEC/2WxwOj3
  131. JUMRyQ9ykEPIzS0GZ/k=
  132. </signature>
  133. <data>
  134. PHBsYWluIHhtbG5zPSJ1cm46eG1wcDpzaWduZWQ6MCIgdGltZXN0YW1wPSIyMDEwLTA2LTI5VDAy
  135. OjE1OjIxLjAxMloiPgogIFBHMWxjM05oWjJVZ2VHMXNibk05SW1waFltSmxjanBqYkdsbGJuUWlJ
  136. R1p5YjIwOUltcDFiR2xsZEVCallYQgogIDFiR1YwTG01bGRDOWlZV3hqYjI1NUlpQjBiejBpY205
  137. dFpXOUFiVzl1ZEdWbmRXVXVibVYwSWlCMGVYQmxQUwogIEpqYUdGMElqNDhkR2h5WldGa1BtTTJN
  138. emN6T0RJMExXRXpNRGN0TkRCa1pDMDRabVV3TFdKaFpEWmxOekk1TwogIFdGa01Ed3ZkR2h5WldG
  139. a1BqeGliMlI1UGxkb1pYSmxabTl5WlNCaGNuUWdkR2h2ZFN3Z1VtOXRaVzgvUEM5aQogIGIyUjVQ
  140. and2YldWemMyRm5aVDQ9CjwvcGxhaW4+Cg==
  141. </data>
  142. </signed>
  143. </message>
  144. ]]></example>
  145. </section2>
  146. <section2 topic="Example of Securing IQs" anchor="ex-iq">
  147. <p>To be added....</p>
  148. </section2>
  149. </section1>
  150. <section1 topic="Interaction with Stanza Semantics" anchor="interact">
  151. <p>The following limitations and caveats apply:</p>
  152. <ul>
  153. <li>Undirected &lt;presence/&gt; stanzas SHOULD NOT be signed.</li>
  154. <li>Stanzas directed to multiplexing services (e.g. multi-user chat) SHOULD NOT be signed,
  155. unless the sender has established the service supports the handling of signed stanzas.</li>
  156. </ul>
  157. </section1>
  158. <section1 topic="Handling of Inbound Stanzas" anchor="inbound">
  159. <p>Several scenarios are possible when an entity receives an encrypted stanza:</p>
  160. <dl>
  161. <di>
  162. <dt>Case #1:</dt>
  163. <dd>The receiving application does not understand the protocol.</dd>
  164. </di>
  165. <di>
  166. <dt>Case #2:</dt>
  167. <dd>The receiving application understands the protocol and is able to verify the
  168. signature.</dd>
  169. </di>
  170. <di>
  171. <dt>Case #3:</dt>
  172. <dd>The receiving application understands the protocol and is able to verify the signature,
  173. but the timestamps fail the checks specified under Checking of Timestamps.</dd>
  174. </di>
  175. <di>
  176. <dt>Case #4:</dt>
  177. <dd>The receiving application understands the protocol and is unable to verify the
  178. signature.</dd>
  179. </di>
  180. </dl>
  181. <p>In Case #1, the receiving application MUST do one and only one of the following: (1) ignore
  182. the &lt;signed/&gt; extension, (2) ignore the entire stanza, or (3), except where precluded by
  183. the protocol (&rfc3920bis;), return a &lt;service-unavailable/&gt; error to the sender.</p>
  184. <p>In Case #2, the receiving application MUST NOT return a stanza error to the sender, since
  185. this is the success case.</p>
  186. <p>In Case #3, the receiving application MAY, except where precluded by the protocol, return a
  187. &lt;not-acceptable/&gt; error to the sender, optionally supplemented by an
  188. application-specific error condition element of &lt;bad-timestamp/&gt; as shown below:</p>
  189. <example><![CDATA[
  190. <message from='romeo@example.net/orchard'
  191. id='6410ed123'
  192. to='juliet@capulet.net/balcony'
  193. type='error'>
  194. <signed xmlns='urn:xmpp:signed:0'>
  195. XML-character-data-here
  196. </signed>
  197. <error type='modify'>
  198. <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  199. <bad-timestamp xmlns='urn:xmpp:signed:0'/>
  200. </error>
  201. </message>
  202. ]]></example>
  203. <p>In Case #4, the receiving application SHOULD, except as precluded by the protocol, return a
  204. &lt;bad-request/&gt; error to the sender, optionally supplemented by an application-specific
  205. error condition element of &lt;bad-signature/&gt; as shown below:</p>
  206. <example><![CDATA[
  207. <message from='romeo@example.net/orchard'
  208. id='6410ed123'
  209. to='juliet@capulet.net/balcony'
  210. type='error'>
  211. <e2e xmlns='urn:xmpp:signed:0'>
  212. XML-character-data-here
  213. </e2e>
  214. <error type='modify'>
  215. <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  216. <bad-signature xmlns='urn:ietf:params:xml:xmpp-signed:0'/>
  217. </error>
  218. </message>
  219. ]]></example>
  220. <p>Additionally in Case #4, the receiving application SHOULD NOT present the stanza to the
  221. intended recipient (human or application) and SHOULD provide some explicit alternate
  222. processing of the stanza (which may be to display a message informing the recipient that it
  223. has received a stanza that cannot be verified).</p>
  224. </section1>
  225. <section1 topic="Inclusion and Checking of Timestamps" anchor="timestamps">
  226. <p>Timestamps are included to help prevent replay attacks. All timestamps MUST conform to
  227. &DATETIME; and be presented as UTC with no offset, always including the seconds and fractions
  228. of a second to three digits (resulting in a datetime 24 characters in length). Absent a local
  229. adjustment to the sending agent's perceived time or the underlying clock time, the sending
  230. agent MUST ensure that the timestamps it sends to the receiver increase monotonically (if
  231. necessary by incrementing the seconds fraction in the timestamp if the clock returns the same
  232. time for multiple requests). The following rules apply to the receiving application:</p>
  233. <ul style="symbols">
  234. <li>It MUST verify that the timestamp received is within five minutes of the current time,
  235. except as described below for offline messages.</li>
  236. <li>If the foregoing check fails, the timestamp SHOULD be presented to the receiving entity
  237. (human or application) marked with descriptive text indicating "old timestamp" or "future
  238. timestamp" and the receiving entity MAY return a stanza error to the sender (except as
  239. precluded in the protocol).</li>
  240. </ul>
  241. <p>The foregoing timestamp checks assume that the recipient is online when the message is
  242. received. However, if the recipient is offline then the server will probably store the message
  243. for delivery when the recipient is next online (offline storage does not apply to &lt;iq/&gt;
  244. or &lt;presence/&gt; stanzas, only &lt;message/&gt; stanzas). As described in &xep0160;, when
  245. sending an offline message to the recipient, the server SHOULD include delayed delivery data
  246. as specified in &xep0203; so that the recipient knows that this is an offline message and also
  247. knows the original time of receipt at the server. In this case, the recipient SHOULD verify
  248. that the timestamp received in the encrypted message is within five minutes of the time
  249. stamped by the recipient's server in the &lt;delay/&gt; element.</p>
  250. </section1>
  251. <section1 topic="Mandatory-to-Implement Cryptographic Algorithms" anchor="mti">
  252. <p>All implementations MUST support the following algorithms. Implementations MAY support other
  253. algorithms as well.</p>
  254. <ul>
  255. <li>TBD (RSA/SHA1? RSASSA-RKCS1-v1_5? RSASSA-PSS?)</li>
  256. </ul>
  257. </section1>
  258. <section1 topic="Certificates" anchor="certs">
  259. <p>To participate in end-to-end signing using the methods defined in this document, a client
  260. needs to possess an X.509 certificate. It is expected that many clients will generate their
  261. own (self-signed) certificates rather than obtain a certificate issued by a certification
  262. authority (CA). In any case the certificate MUST include an XMPP address that is represented
  263. using the ASN.1 Object Identifier "id-on-xmppAddr" as specified in Section 5.1.1 of
  264. RFC 3920bis.</p>
  265. </section1>
  266. <section1 topic="Security Considerations" anchor="security">
  267. <p>TBD.</p>
  268. </section1>
  269. <section1 topic="XMPP Registrar Considerations" anchor="reg">
  270. <section2 topic="XML Namespace Name for Signed Data in XMPP" anchor="ns">
  271. <p>A URN sub-namespace of signed content for the Extensible Messaging and Presence Protocol
  272. (XMPP) is defined as follows.</p>
  273. <dl>
  274. <di>
  275. <dt>URI:</dt>
  276. <dd>urn:xmpp:signed</dd>
  277. </di>
  278. <di>
  279. <dt>Specification:</dt>
  280. <dd>ProtoXEP</dd>
  281. </di>
  282. <di>
  283. <dt>Description:</dt>
  284. <dd>This is an XML namespace name of signed content for the Extensible Messaging and
  285. Presence Protocol as defined by ProtoXEP.</dd>
  286. </di>
  287. <di>
  288. <dt>Registrant Contact:</dt>
  289. <dd>XSF</dd>
  290. </di>
  291. </dl>
  292. </section2>
  293. </section1>
  294. <section1 topic="Acknowledgements" anchor="ack">
  295. <p>This document borrows ideas and text from End-to-End Object Encryption "work in progress" by
  296. Matthew Miller and Peter Saint-Andre.</p>
  297. </section1>
  298. </xep>