%ents; ]>
Use of Cryptographic Hash Functions in XMPP This document provides a common wire format for the transport of cryptographic hash function references and hash function values in XMPP protocol extensions. &LEGALNOTICE; 0300 Draft Standards Track Standards Council XMPP Core hashes &stpeter; &mwild; &ksmith; &tobias; 1.0.0 2019-11-13 mb

Advance to Draft as per 2019-09-19 Council vote

0.6.0 2019-04-28 jsc

Remove hash function recommendations to be able to advance this without tying down the recommendations. Recommendations are now in XEP-0414.

0.5.3 2018-02-14 fs

Clarify textual content of the <hash/> element.

0.5.2 2017-08-21 ps

Add hash-used element

0.5.1 2017-03-17 fs

Use xs:base64Binary instead of xs:string in the schema

0.5 2017-01-24 tobias

Explicitly specify encoding format. Namespace version bump to urn:xmpp:hashes:2.

0.4 2016-05-16 tobias

Updating to current knowledge on security of algorithms. Adding SHA-3 and BLAKE families of hashes.

0.3 2012-02-08 psa

Modified XML structure to remove wrapper element; added recommendations for new XMPP extensions; softened recommendations for existing extensions.

0.2 2011-12-05 psa

Updated to reflect initial analysis of existing XMPP protocol extensions.

0.1 2011-06-29 psa

Initial published version.

0.0.2 2011-06-22 mw/ks/psa

Adjusted format to include multiple hashes in one element; modified namespace versioning rules to align with common practice; added service discovery features for various algorithms.

0.0.1 2011-06-16 psa

Rough draft based on list discussion.

Various XMPP extensions make use of cryptographic hash functions, but they do so in different ways (e.g., some define XML elements and some define XML attributes) and often mandate support for different algorithms. The lack of a consistent approach to the use of cryptographic hash functions in XMPP extensions can lead to interoperability problems and security vulnerabilities. Therefore, this document recommends a common approach and XML element that can be re-used in any XMPP protocol extension.

This extension is designed to meet the following criteria:

Agility
It is absolutely necessary to support more secure cryptographic hash functions as they become available, and to stop supporting less secure functions as they are deprecated. The wire format should make it easy to use multiple hash functions at the same time.
Reusability
The extension needs to be reusable in any XMPP protocol.

This document defines a new XML element that can be used in any XMPP protocol extension. An example follows.

2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU=]]>

An XMPP protocol can include more than one instance of the <hash/> element, as long as each one has a different value for the 'algo' attribute:

2AfMGH8O7UNPTvUVAM9aK13mpCY= 2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU=]]>

In certain scenarios it makes sense to communicate the hash algorithm that is used prior to the calculation of the hash value.

]]>

The value of the 'algo' attribute MUST be one of the values from the &ianahashes; maintained by &IANA;, or one of the values defined in the following table.

Hash Function Name Reference
"sha3-256" FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions <http://dx.doi.org/10.6028/NIST.FIPS.202>.
"sha3-512" FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions <http://dx.doi.org/10.6028/NIST.FIPS.202>.
"blake2b-256" &rfc7693;
"blake2b-512" &rfc7693;

The digest produced by the used hash algorithm is included as the XML character data of the <hash/> element after being encoded using Base64 as specified in Section 4 of &rfc4648;. Thus the character data MUST conform to the base64Binary datatype See <http://www.w3.org/TR/xmlschema-2/#base64Binary>. as defined in &w3xmlschema2;. The Base64 output MUST NOT include whitespace and MUST set padding bits to zero.

Previously, this document made recommendations for specific hash functions. Those documentations have been removed in version 0.6.0 and are now found in &xep0414;.

If an entity supports the protocol defined herein, it MUST report that by including a &xep0030; feature of "urn:xmpp:hashes:2" in response to disco#info requests, along with one service discovery feature for each algorithm it supports:

]]> ]]>

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.

The XSF is strongly encouraged to incorporate hash agility into new XMPP extensions that it develops by mandating re-use of the protocol defined in this specification (instead of hash elements or attributes specific to each extension).

Specifications should take the considerations in &xep0414; into account.

This entire document discusses security.

This document requires no interaction with the IANA. However, it reuses entries from the relevant IANA registry.

This specification defines the following XML namespace:

  • urn:xmpp:hashes:2

The ®ISTRAR; shall include the foregoing namespace in its registry at &NAMESPACES;, as governed by &xep0053;.

&NSVER;

An entity SHOULD provide one service discovery feature for each algorithm it supports. Ideally these features would be of the form "urn:iana:hash-function-text-names:foo" (where "foo" is the name of an algorithm registered with the IANA); however there is no urn:iana namespace at present. Until there is, we use features of the form "urn:xmpp:hash-function-text-names:foo" instead. Therefore the registry submission is as follows.

urn:xmpp:hash-function-text-names:md5 Support for the MD5 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:sha-1 Support for the SHA-1 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:sha-224 Support for the SHA-224 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:sha-256 Support for the SHA-256 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:sha-384 Support for the SHA-384 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:sha-512 Support for the SHA-512 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:sha3-224 Support for the SHA3-224 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:sha3-256 Support for the SHA3-256 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:sha3-384 Support for the SHA3-384 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:sha3-512 Support for the SHA3-512 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:id-blake2b160 Support for the BLAKE2b-160 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:id-blake2b256 Support for the BLAKE2b-256 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:id-blake2b384 Support for the BLAKE2b-384 hashing algorithm XEP-0300 urn:xmpp:hash-function-text-names:id-blake2b512 Support for the BLAKE2b-512 hashing algorithm XEP-0300 ]]>
]]>

Thanks to Dave Cridland, Waqas Hussain, Glenn Maynard, Remko Tronçon, Paul Schaub, Christian Schudt, and Florian Schmaus for their input.