<remark><p>Defined an RSA-specific child element of the pubkey element to contain the modulus, public exponent, and fingerprint directly (rather than a DER-encoded format that depends on ASN.1); specified that the public exponent should be 65537; clarified the fingerprint generation method and updated all of the fingerprint formats to enable hash agility; incremented namespaces from version 1 to version 2.</p></remark>
<remark><p>Updated the fingerprint generation method to hash over the begin date, end date, JID, and public key (not just the key itself).</p></remark>
<remark><p>Major revision; split into three namespaces and three corresponding PEP nodes, one each for public keys, attestations, and revocations; iterated the version number for public keys to urn:xmpp:pubkey:1; added detailed data to each node payload; removed some use cases to simply the protocol.</p></remark>
<remark><p>Required specification of an algorithm for elements with hashes; removed fingerprint in <keyinfo/>; added sign request; added guidelines for key management; improved examples; changed namespace from urn:xmpp:tmp:pubkey to urn:xmpp:pubkey:0.</p></remark>
<remark><p>Merged node creation and first publish examples; recommended the value of each <KeyName/> element and id attribute is set to the key fingerprint; added fprint element and more examples</p></remark>
<p>End-to-end encryption between XMPP clients and mutual authentication between a client and a server are desirable goals for the XMPP network. To enable these features, typically an XMPP user will need to possess a public key (or multiple keys), along with an associated private key that is not made public. The goal of this document is to provide simple methods for the exchange of public keys among XMPP users -- specifically, data formats that enable an XMPP entity to complete the following use cases:</p>
<p>This document assumes that each user will have a privately-generated key. A user <strong>might</strong> have more than one key (e.g., different keys for different clients) and the user's key <strong>might</strong> be signed by other entities, such as a certification authority (CA) or another user. However, the simplest case is a single key per user.</p>
<p>The data formats defined here are deliberately kept very simple, with the key itself represented as by the modulus and the public exponent, and any metadata represented using a few straightforward XML elements and attributes. This document does not use the 'http://www.w3.org/2000/09/xmldsig#' namespace as specified in &w3xmlsig;; although that format is quite powerful, it introduces unnecessary levels of complexity for this use case. In addition, this document has no dependency on ASN.1, whose use is problematic on some computing platforms and languages (e.g., JavaScript).</p>
<p>A single public key is contained in a <pubkey/> element qualified by the 'urn:xmpp:pubkey:2' namespace &VNOTE;, for which the defined child elements are as follows:</p>
<td>An element with three defined children for the modulus, public exponent, and fingerprint, where the input string to the hash function is the concatenation of the begin date, the end date, the JID, the string representation of the modulus, and the string representation of the public exponent, all encoded according to UTF-8 -- e.g., Base64(SHA-256(UTF8-encode(begin + end + jid + str(modulus) + str(exponent))).</td>
<p>The children of the <rsakey/> element are as follows.</p>
<tablecaption='Children of the <rsakey/> Element'>
<tr>
<th>Element</th>
<th>Description</th>
</tr>
<tr>
<td><modulus/></td>
<td>A large random number used as input to encryption and signing operations.</td>
</tr>
<tr>
<td><publicExponent/></td>
<td>The public exponent used as input to encryption and signing operations; RECOMMENDED to be "65537".</td>
</tr>
<tr>
<td><print/></td>
<td>A fingerprint for the key, where the algorithm used to generate the fingerprint is specified by the 'algo' attribute (whose default value is "sha-256").</td>
<p>A user can revoke his own key. The revocation is contained in a <revoke/> element qualified by the 'urn:xmpp:revoke:2' namespace &VNOTE;, for which the defined child elements are as follows:</p>
<td>The fingerprint of the key that was used to sign the revocation, where the algorithm is specified by the 'algo' attribute (which defaults to "sha-256").</td>
<p>The data that is signed MUST be the revoked public key (i.e., the XML character data of the <key/> element), the fingerprint of the revoked public key (i.e., the XML character data of the <keyprint/> element), the fingerprint of the key used to sign the revocation (i.e., the XML character data of the <revocationprint/> element), and the time of the revocation (i.e., the XML character data of the <revocationtime/> element), concatenated together with no spaces or other additional characters.</p>
<p>As an example, consider a revocation of the key from Example 1, where the fingerprint of the revoked key is 13475c8e27399908b4447d7c52ab30822872832eba3a654f0d80e07fb4157673, the fingerprint of the key used to sign the revocation is becb78566783166f4a1a7c64e28dae288fe1a0f2825f6b593b336ce186c6b056, and the time of the revocation is 2009-12-14T20:49:16Z. The string to be signed would be as follows (where line breaks are not significant).</p>
<p>Whether in the context of the public key infrastructure (PKI) or a web of trust, a user might want to publish signed copies of his public key, where the signer might be another user or a trusted third party such as a certification authority (CA). The signing key could even be another key owned by the user (e.g., a primary key used to sign a secondary key associated with a particular device controlled by the user). Furthermore, the signing material might be an RSA key, a DSA key, an X.509 certificate, an OpenPGP key, or any other format.</p>
<p>Each signed copy is contained in an <attest/> element qualified by the 'urn:xmpp:attest:2' namespace &VNOTE;, for which the defined child elements are as follows:</p>
<p>The data that is signed MUST be the user's public key (i.e., the XML character data of the <key/> element), the fingerprint of the user's public key (i.e., the XML character data of the <keyprint/> element), the signer's JID (i.e., the XML character data of the <signerjid/> element), the fingerprint of the signer's key (i.e., the XML character data of the <signerprint/> element), and the time of the attestation (i.e., the XML character data of the <signtime/> element), concatenated together with no spaces or other additional characters.</p>
<p>As an example, consider an attestation of the key from Example 1, where the signer's JID is stpeter@jabber.org, the fingerprint of the signer's key is "becb78566783166f4a1a7c64e28dae288fe1a0f2825f6b593b336ce186c6b056", and the time of the attestation is 2009-12-14T18:43:00Z. The string to be signed would be as follows (where line breaks are not significant).</p>
<p>A user SHOULD publish public keys, attestations, and revocations via &xep0163;, in particular adhering to the best practices defined in &xep0222;.</p>
<p>Any other authorized entity can then receive notifications related to the user's public keys, and retrieve keys, attestations, and revocations.</p>
<p>If the user has only one public key (the simplest and most common case), then the pubkey PEP node SHOULD have only one item, with an ItemID of "current".</p>
<p>If it is not possible for the user to publish his key via PEP, or for a contact to retrieve the user's key via PEP, the contact MAY request the user's key directly by sending an &IQ; of type 'get' to the user's particular full JID, containing an empty <pubkey/> element qualified by the 'urn:xmpp:pubkey:2' namespace &VNOTE;.</p>
<p>The receiving client then return its public key (which might be different from the overall key for the user, e.g. a key for only a particular device).</p>
<section1topic='Sending a Public Key Directly'anchor='send'>
<p>An entity might need to send its public key to another entity, for example if it has generated a new key but does not have a way to publish the new key (or does not wish to publish the key in a world-readable fashion). In this case the entity MAY include the key directly in a &MESSAGE; stanza.</p>
<examplecaption='Sending a key in a message'><![CDATA[
<p>There are several situations in which it is helpful for an entity to signal that it is currently generating a key. For example, a client that does not have access to permanent storage might generate a key on startup, but key generation might not be complete when the client sends initial presence upon establishing an XMPP session. In this case the client might signal support for the public key format in the entity capabilities data that it includes in its initial presence broadcast, but also include an indication that it is currently generating a key.</p>
<examplecaption='Key generation in progress'><![CDATA[
<p>After key generation is complete, the entity could publish the new key to the appropriate PEP node (if available) and send updated presence without the <generating/> extension.</p>
<p>To advertise its support for public keys, revocations, and attestations, when replying to &xep0030; information requests an entity MUST return features for 'urn:xmpp:pubkey:2', 'urn:xmpp:revoke:2', and 'urn:xmpp:attest:2' respectively.</p>
<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>
<p>The reliable association between a user or entity and its public keys is beyond the scope of this document. However, each client SHOULD maintain its own secure library of the public keys it associates with other users.</p>
<p>Upon advancement of this specification to a status of Draft, the ®ISTRAR; shall add these namespaces to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>