1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-12-01 13:42:14 -05:00
xeps/xep-0189.xml

454 lines
19 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Public Key Publishing</title>
<abstract>This document specifies how an entity may publish its public keys over XMPP.</abstract>
&LEGALNOTICE;
<number>0189</number>
<status>Proposed</status>
<type>Standards Track</type>
<sig>Standards</sig>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0060</spec>
<spec>XEP-0163</spec>
<spec>W3C XML Signature</spec>
</dependencies>
<supersedes>None</supersedes>
<supersededby>None</supersededby>
<shortname>NOT YET ASSIGNED</shortname>
&ianpaterson;
<revision>
<version>0.5</version>
<date>2007-03-05</date>
<initials>ip</initials>
<remark><p>Merged node creation and first publish examples; recommended the value of each &lt;KeyName/&gt; element and id attribute is set to the key fingerprint; added fprint element and more examples</p></remark>
</revision>
<revision>
<version>0.4</version>
<date>2006-11-27</date>
<initials>ip</initials>
<remark><p>Added jid attribute and send use case; changed namespace</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2006-11-20</date>
<initials>ip</initials>
<remark><p>Specified that PEP nodes SHOULD be persistent</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2006-09-29</date>
<initials>ip</initials>
<remark><p>Replaced pubkey and key elements with the KeyInfo element defined in W3C XML Signature</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2006-07-18</date>
<initials>ip</initials>
<remark><p>Initial version.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>This document defines different methods an entity may use for publishing its long-term public keys:</p>
<ul>
<li>Publishing public keys to a set of subscribers.</li>
<li>Querying another entity for its public keys.</li>
</ul>
<p>An entity MAY have multiple public keys with different formats, signatures, algorithms, strengths and expiry dates. Each client used by a user may use different keys.</p>
</section1>
<section1 topic='Public Key Publication via PEP' anchor='usecases-pub'>
<p>An entity SHOULD use &xep0163; to publish all its long-term public keys via its own server.</p>
<p>If the pubkeys PEP node does not exist already then the entity MUST create it. In this case, the entity SHOULD specify that items published to the node are persistent and that the keys will only be pushed to subscribers whenever new keys are published (i.e. not when subscribers become newly available or when a new subscription is created). If the user wants to control access to his/her identity (see <link url='#security'>Security Considerations</link>) then the entity MUST also specify an appropriate access model other than "Open". The entity MAY create the node by including a &lt;configure/&gt; element when publishing a key for the first time (note: this functionality is not yet supported by &xep0060;).</p>
<p>The entity can update the keys that the node contains at any time. The value of the 'id' attribute of each &lt;item/&gt; element SHOULD be set to the fingerprint of the public key. i.e., the SHA256 hash (see &nistfips180-2;) of the key's normalized &lt;KeyValue/&gt;, &lt;PGPData/&gt; or &lt;X509Data/&gt; element (all character data <em>between</em> all elements MUST be removed and the XML MUST be converted to canonical form - see &w3canon;). Thus subscribers are able to request a single key by specifying its fingerprint (for example, when a subscriber is using the &xep0116; protocol).</p>
<p>Each public key MUST be wrapped in a &lt;KeyInfo/&gt; element as specified in &w3xmlsig;. Each &lt;KeyInfo/&gt; element published using PEP MUST contain a &lt;KeyName/&gt; element with a unique (for the user) name to allow the key to be referenced by other XMPP Extension Protocols (for example, &xep0136;). The name MAY be the same as the value of the 'id' attribute. However, if two &lt;KeyInfo/&gt; elements contain the same public key in different formats (for example, an X.509 certificate may contain an RSA key), then the name of the two keys SHOULD be the same.</p>
<example caption='Entity Creates Public Keys Publishing Node and Publishes an RSA Key to its Server'><![CDATA[
<iq from='juliet@capulet.com/balcony' type='set' id='pub1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<item id='julietRSAkey1hash'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyName>julietRSAkey1hash</KeyName>
<KeyValue>
<RSAKeyValue>
<Modulus>...</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
</item>
</publish>
<configure>
<x xmlns='jabber:x:data' type='submit'>
<field var='FORM_TYPE' type='hidden'>
<value>http://jabber.org/protocol/pubsub#node_config</value>
</field>
<field var='pubsub#persist_items'>
<value>1</value>
</field>
<field var='pubsub#send_last_published_item'>
<value>never</value>
</field>
<field var='pubsub#access_model'>
<value>roster</value>
</field>
<field var='pubsub#roster_groups_allowed'>
<value>friends</value>
</field>
</x>
</configure>
</pubsub>
</iq>
]]></example>
<example caption='Entity Publishes a DSA Key to its Server'><![CDATA[
<iq from='juliet@capulet.com/balcony' type='set' id='pub2'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<item id='julietDSAkey1hash'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyName>julietDSAkey1hash</KeyName>
<KeyValue>
<DSAKeyValue>
<P>...</P>
<Q>...</Q>
<G>...</G>
<Y>...</Y>
</DSAKeyValue>
</KeyValue>
</KeyInfo>
</item>
</publish>
</pubsub>
</iq>
]]></example>
<example caption='Entity Publishes an X.509 Certificate to its Server'><![CDATA[
<iq from='juliet@capulet.com/balcony' type='set' id='pub3'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<item id='julietX509cert1hash'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyName>julietX509cert1hash</KeyName>
<X509Data>
<X509IssuerSerial>
<X509IssuerName>CN=TAMURA Kent, OU=TRL, O=IBM, L=Yamato-shi, ST=Kanagawa, C=JP</X509IssuerName>
<X509SerialNumber>12345678</X509SerialNumber>
</X509IssuerSerial>
<X509SKI>31d97bd7</X509SKI>
<X509SubjectName>Subject of Certificate B</X509SubjectName>
<X509Certificate>...</X509Certificate>
<X509Certificate>...</X509Certificate>
<X509Certificate>...</X509Certificate>
</X509Data>
</KeyInfo>
</item>
</publish>
</pubsub>
</iq>
]]></example>
<example caption='Entity Publishes a PGP Key to its Server'><![CDATA[
<iq from='juliet@capulet.com/balcony' type='set' id='pub4'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<item id='julietPGPkey1hash'>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyName>julietPGPkey1hash</KeyName>
<PGPData>
<PGPKeyId>...</PGPKeyId>
<PGPKeyPacket>...</PGPKeyPacket>
</PGPData>
</KeyInfo>
</item>
</publish>
</pubsub>
</iq>
]]></example>
<example caption='Subscriber Receives Event with Key'><![CDATA[
<message to='romeo@montague.net/garden' from='juliet@capulet.com' type='headline'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<item id='julietRSAkey1hash'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyName>julietRSAkey1hash</KeyName>
<KeyValue>
<RSAKeyValue>
<Modulus>...</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
</item>
</items>
</event>
<addresses xmlns='http://jabber.org/protocol/address'>
<address type='replyto' jid='juliet@capulet.com/balcony'/>
</addresses>
</message>
]]></example>
<p>Note: The stanza containing the event notification (see example above) MAY also include 'replyto' data (as specified by the &xep0033; protocol) to provide an explicit association between the published data and the <em>resource</em> that published it.</p>
</section1>
<section1 topic='Public Key Retrieval via PEP' anchor='usecases-retrieve'>
<example caption='Subscriber Requests Keys from Account'><![CDATA[
<iq type='get'
to='juliet@capulet.com'
from='romeo@montague.net/garden'
id='items1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='http://www.xmpp.org/extensions/xep-0189.html#ns'/>
</pubsub>
</iq>
]]></example>
<example caption='Entity&apos;s Server Returns Keys to Subscriber'><![CDATA[
<iq type='result'
to='romeo@montague.net/garden'
from='juliet@capulet.com'
id='items1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<item id='julietRSAkey1hash'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyName>julietRSAkey1hash</KeyName>
...
</KeyInfo>
</item>
<item id='julietDSAkey1hash'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyName>julietDSAkey1hash</KeyName>
...
</KeyInfo>
</item>
<item id='julietX509cert1hash'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyName>julietX509cert1hash</KeyName>
...
</KeyInfo>
</item>
<item id='julietPGPkey1hash'>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyName>julietPGPkey1hash</KeyName>
...
</KeyInfo>
</item>
</items>
</pubsub>
</iq>
]]></example>
<example caption='Subscriber Requests Specific Key'><![CDATA[
<iq type='get'
to='juliet@capulet.com'
from='romeo@montague.net/garden'
id='items2'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<item id='julietRSAkey1hash'/>
</items>
</pubsub>
</iq>
]]></example>
<example caption='Entity&apos;s Server Returns Key to Subscriber'><![CDATA[
<iq type='result'
to='romeo@montague.net/garden'
from='juliet@capulet.com'
id='items2'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<item id='julietRSAkey1hash'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyName>julietRSAkey1hash</KeyName>
<KeyValue>
<RSAKeyValue>
<Modulus>...</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
</item>
</items>
</pubsub>
</iq>
]]></example>
</section1>
<section1 topic='Requesting Public Keys Directly From Another Entity' anchor='usecases-request'>
<p>If an entity wishes to request the public keys of another entity and it cannot access the keys via <cite>Personal Eventing via Pubsub</cite>, then the entity MAY send an &IQ; of type 'get' to the other entity:</p>
<example caption='Public keys request'><![CDATA[
<iq type='get'
id='keys1'
to='juliet@capulet.com/balcony'
from='romeo@montague.net/garden'>
<pubkeys xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns'/>
</iq>
]]></example>
<p>The other entity MUST make a careful access control decision before returning only those public keys for which it holds the corresponding private key (not necessarily the full list of keys being published via <cite>Personal Eventing via Pubsub</cite>):</p>
<example caption='Successful public keys response'><![CDATA[
<iq type='result'
id='keys1'
to='romeo@montague.net/garden'
from='juliet@capulet.com/balcony'>
<pubkeys xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
...
</KeyInfo>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
...
</KeyInfo>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
...
</KeyInfo>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
...
</KeyInfo>
</pubkeys>
</iq>
]]></example>
<p>If the receiving entity decides not to return the public keys, it MUST return an IQ error, which SHOULD be &unavailable; (to avoid divulging presence to unauthorized entities), but MAY be some other appropriate error, such as &forbidden; or &notallowed;:</p>
<example caption='Access to public keys denied'><![CDATA[
<iq type='error'
id='keys1'
to='romeo@montague.net/garden'
from='juliet@capulet.com/balcony'>
<pubkeys xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns'/>
<error code='503' type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
]]></example>
<p>An entity MAY request one or more specific public keys by specifying their fingerprints (see <link url='#usecases-pub'>Public Key Publication via PEP</link>) as the content of &lt;fprint/&gt; child elements:</p>
<example caption='Specific public keys request'><![CDATA[
<iq type='get'
id='keys2'
to='juliet@capulet.com/balcony'
from='romeo@montague.net/garden'>
<pubkeys xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<fprint>julietRSAkey1hash</fprint>
<fprint>julietRSAkey2hash</fprint>
</pubkeys>
</iq>
]]></example>
<example caption='Successful specific public keys response'><![CDATA[
<iq type='result'
id='keys2'
to='romeo@montague.net/garden'
from='juliet@capulet.com/balcony'>
<pubkeys xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
...
</KeyInfo>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
...
</KeyInfo>
</pubkeys>
</iq>
]]></example>
</section1>
<section1 topic='Requesting Public Keys Directly From a Third Party' anchor='usecases-third'>
<p>An entity may request the public keys of another entity from a third party using the 'jid' attribute of the &lt;pubkeys/&gt; element to specify the JID that the keys belong to:</p>
<example caption='Requesting public keys from a third-party'><![CDATA[
<iq type='get'
id='keys3'
to='juliet@capulet.com/balcony'
from='romeo@montague.net/garden'>
<pubkeys xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns' jid='benvolio@capulet.com'/>
</iq>
]]></example>
<example caption='Third-party responds with public keys'><![CDATA[
<iq type='result'
id='keys3'
to='romeo@montague.net/garden'
from='juliet@capulet.com/balcony'>
<pubkeys xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns' jid='benvolio@capulet.com'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
...
</KeyInfo>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
...
</KeyInfo>
</pubkeys>
</iq>
]]></example>
<example caption='Third party has no copies of the keys'><![CDATA[
<iq type='error'
id='keys3'
to='romeo@montague.net/garden'
from='juliet@capulet.com/balcony'>
<pubkeys xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns' jid='benvolio@capulet.com'/>
<error code='404' type='cancel'>
<item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
]]></example>
</section1>
<section1 topic='Sending Public Keys Directly To Another Entity' anchor='usecases-send'>
<p>If an entity wishes to send public keys to another entity then it MAY include them in a &MESSAGE; stanza. The entity MAY use the 'jid' attribute of the &lt;pubkeys/&gt; element to specify the JID that the keys belong to. If no 'jid' attribute is specified then the other entity SHOULD assume the keys belong to the sender of the stanza.</p>
<example caption='Sending public keys'><![CDATA[
<message to='romeo@montague.net/garden'
from='juliet@capulet.com/balcony'>
<pubkeys xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns' jid='benvolio@capulet.com'>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyValue>
<RSAKeyValue>
<Modulus>...</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
<KeyInfo xmlns='http://www.w3.org/2000/09/xmldsig#'>
<KeyValue>
<RSAKeyValue>
<Modulus>...</Modulus>
<Exponent>AQAB</Exponent>
</RSAKeyValue>
</KeyValue>
</KeyInfo>
</pubkeys>
</message>
]]></example>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<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 (or the "fingerprints" of the keys) it associates with other users (not necessarily JIDs).</p>
<p>Whenever public keys are published an identity is typically associated with a JID. Although the public keys are public information, it may be critically important for the user of the JID to keep his identity secret from all but a few specified people. Implementors MUST take great care to ensure the identity of the user of a JID is never divulged to anyone except the entities who have been permitted by the user to access the public key.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>Until this specification advances to a status of Draft, its associated namespace shall be "http://www.xmpp.org/extensions/xep-0189.html#ns"; upon advancement of this specification, the XMPP Registrar shall issue a permanent namespace in accordance with the process defined in Section 4 of &xep0053;.</p>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='http://www.xmpp.org/extensions/xep-0189.html#ns'
xmlns='http://www.xmpp.org/extensions/xep-0189.html#ns'
elementFormDefault='qualified'>
<xs:element name='pubkeys'>
<xs:complexType>
<xs:choice minOccurs='0' maxOccurs='unbounded'>
<xs:element name='fprint' type='xs:string'/>
<xs:any processContents='lax' namespace='##any'/>
</xs:choice>
<xs:attribute name='jid' type='xs:string' use='optional'/>
<xs:anyAttribute namespace='##any' processContents='lax'/>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section1>
</xep>