<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
	<title>Automatic Trust Management (ATM)</title>
	<abstract>
		This document specifies a way to automatically manage the trust in public long-term keys used by end-to-end encryption protocols.
	</abstract>
	
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.</permissions>
<warranty>## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##</warranty>
<liability>In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.</liability>
<conformance>This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
	<number>0450</number>
	<status>Experimental</status>
	<type>Standards Track</type>
	<sig>Standards</sig>
	<approver>Council</approver>
	<dependencies>
		<spec>XMPP Core</spec>
		<spec>XEP-0001</spec>
		<spec>XEP-0280</spec>
		<spec>XEP-0334</spec>
		<spec>XEP-0420</spec>
		<spec>XEP-0434</spec>
	</dependencies>
	<supersedes/>
	<supersededby/>
	<shortname>ATM</shortname>
	
  <author>
    <firstname>Melvin</firstname>
    <surname>Keskin</surname>
    <email>melvo@olomono.de</email>
    <jid>melvo@olomono.de</jid>
  </author>

	<revision>
		<version>0.4.0</version>
		<date>2021-10-04</date>
		<initials>melvo</initials>
		<remark>
			<p>Update to XEP-0434 version 0.6.0 and XEP-0384 version 0.8.0:</p>
			<ul>
				<li>Use Base64-encoded key identifiers in examples</li>
				<li>Update TM's namespace to 'urn:xmpp:tm:1'</li>
				<li>Update OMEMO's namespace to 'urn:xmpp:omemo:2'</li>
			</ul>
		</remark>
	</revision>
	<revision>
		<version>0.3.2</version>
		<date>2021-06-27</date>
		<initials>melvo</initials>
		<remark>Use 'distrusted' consistently</remark>
	</revision>
	<revision>
		<version>0.3.1</version>
		<date>2021-05-14</date>
		<initials>melvo</initials>
		<remark>
			<p>Improve examples and apply consistent formatting:</p>
			<ul>
				<li>Replace wrong recipient in example by 'alice@example.org'</li>
				<li>Use recipient 'bob@example.com' in examples consistently</li>
				<li>Apply consistent formatting for revision history</li>
			</ul>
		</remark>
	</revision>
	<revision>
		<version>0.3.0</version>
		<date>2021-04-16</date>
		<initials>melvo</initials>
		<remark>
			<p>Update to XEP-0420 version 0.4.0 and XEP-0434 version 0.5.0:</p>
			<ul>
				<li>Replace SCE's old 'content' element by its new 'envelope' element</li>
				<li>Replace SCE's old 'payload' element by its new 'content' element</li>
				<li>Update SCE's namespace to 'urn:xmpp:sce:1'</li>
				<li>Update TM's namespace to 'urn:xmpp:tm:0'</li>
				<li>Update namespace to 'urn:xmpp:atm:1'</li>
			</ul>
		</remark>
	</revision>
	<revision>
		<version>0.2.0</version>
		<date>2021-04-13</date>
		<initials>melvo</initials>
		<remark>
			<p>Add usage of Trust Message URIs, use more precise sentences, apply consistent formatting:</p>
			<ul>
				<li>Add usage of Trust Message URIs for initial authentications</li>
				<li>Use 'that' instead of 'which' for restrictive clauses</li>
				<li>Apply consistent formatting for paragraphs and revision history</li>
			</ul>
		</remark>
	</revision>
	<revision>
		<version>0.1.0</version>
		<date>2020-12-15</date>
		<initials>XEP Editor (jsc)</initials>
		<remark>Accepted by vote of Council on 2020-12-02</remark>
	</revision>
		<revision>
		<version>0.0.1</version>
		<date>2020-11-05</date>
		<initials>melvo</initials>
		<remark>First draft</remark>
	</revision>
</header>
<section1 topic="Introduction" anchor="introduction">
	<p>
		End-to-end encryption can easily be used to protect most of the communication nowadays.
		However, the management of trust in long-term keys used for encryption is still a manual task.
		With ATM, many steps that can be automated for the trust management are no longer a manual task the users have to take care of.
	</p>
	<p>
		ATM reduces the steps needed for authenticating or distrusting keys of endpoints between two identities (XMPP accounts / bare JIDs).
		It uses <span class="ref"><link url="https://xmpp.org/extensions/xep-0434.html">Trust Messages (XEP-0434)</link></span> <note>XEP-0434: Trust Messages &lt;<link url="https://xmpp.org/extensions/xep-0434.html">https://xmpp.org/extensions/xep-0434.html</link>&gt;.</note> for automatically establishing secure channels protected against active attacks between a new endpoint and existing ones after an initial mutual authentication between the new endpoint and one of the existing ones.
	</p>
	<p>
		Trust messages are sent encrypted only to endpoints with authenticated keys.
		ATM preserves the security level as if all endpoints of the two identities authenticated or distrusted their keys manually.
		It can be used especially for end-to-end encryption protocols such as <span class="ref"><link url="https://xmpp.org/extensions/xep-0384.html">OMEMO Encryption (XEP-0384)</link></span> <note>XEP-0384: OMEMO Encryption &lt;<link url="https://xmpp.org/extensions/xep-0384.html">https://xmpp.org/extensions/xep-0384.html</link>&gt;.</note> that use one key per endpoint of the same identity.
	</p>
</section1>
<section1 topic="Glossary" anchor="glossary">
	<dl>
		<di>
			<dt>External glossary</dt>
			<dd>
				The terms of <span class="ref"><link url="https://xmpp.org/extensions/xep-0434.html">Trust Messages (XEP-0434)</link></span> <note>XEP-0434: Trust Messages &lt;<link url="https://xmpp.org/extensions/xep-0434.html">https://xmpp.org/extensions/xep-0434.html</link>&gt;.</note>'s glossary are also relevant for this XEP.
			</dd>
		</di>
		<di>
			<dt>Manual key authentication</dt>
			<dd>Key authentication with user interaction (e.g., QR code scanning, fingerprint verification)</dd>
		</di>
		<di>
			<dt>Automatic key authentication</dt>
			<dd>Key authentication without user interaction (e.g., via ATM)</dd>
		</di>
		<di>
			<dt>Initial key authentication</dt>
			<dd>Key authentication needed for all further automatic key authentications made by ATM</dd>
		</di>
		<di>
			<dt>Mutual key authentication</dt>
			<dd>Key authentication in which two endpoints authenticate each other's key</dd>
		</di>
		<di>
			<dt>Key distrusting</dt>
			<dd>Revoking the trust in a key</dd>
		</di>
		<di>
			<dt>Manual key distrusting</dt>
			<dd>Key distrusting with user interaction (e.g., clicking a "Distrust" button)</dd>
		</di>
		<di>
			<dt>Automatic key distrusting</dt>
			<dd>Key distrusting without user interaction (e.g., via ATM)</dd>
		</di>
		<di>
			<dt>Authentication message</dt>
			<dd>
				Trust message that only contains key identifiers for authentication.
				If a trust message contains authentication and distrusting parts, the term authentication message is used for referring to the trust message without the distrusting parts.
			</dd>
		</di>
		<di>
			<dt>Distrust message</dt>
			<dd>
				Trust message that only contains key identifiers for distrusting.
				If a trust message contains authentication and distrusting parts, the term distrust message is used for referring to the trust message without the authentication parts.
			</dd>
		</di>
	</dl>
</section1>
<section1 topic="Details" anchor="details">
	<p>
		The goal of key authentication is to create an end-to-end encrypted communication network exclusively of endpoints with authenticated keys.
		As a result, every communication channel between those endpoints is resistant against active attacks.
	</p>
	<p>
		The network of endpoints that authenticated each other's keys can be seen as a complete graph where each endpoint is a node and each mutual authentication is an edge.
		The number of edges grows for each new endpoint by the number of existing nodes.
		This is due to the fact that in order to sustain secure channels between all endpoints, a new key has to be authenticated by all n existing endpoints and vice versa.
	</p>
	<p>
		One of those n mutual authentications requires a third party or user interaction like scanning each other's QR code or comparing each other's key identifier by hand.
		That is the initial mutual authentication.
		A trusted third party MAY be used for the initial authentication but a manual authentication SHOULD be preferred since it does not depend on the trust in the third party.
		The remaining authentications can be automated relying on the secure channel established by the initial mutual authentication and the secure channels already created by the same procedure between the rest of the endpoints.
	</p>
	<p>
		For creating the described complete graph with n nodes, a total of T(n) = (n*(n-1))/2 ∊ O(n²) mutual authentications are needed.
		When using ATM, only T(n) = n-1 ∊ O(n) of them have to be made as initial mutual authentications.
		All remaining authentications can be performed automatically by ATM.
		Thus, less user interaction is needed for authenticating all keys involved in the secure communication while preserving the same security level as the manual authentication.
	</p>
</section1>
<section1 topic="Use Cases" anchor="use-cases">
	<p>
		Everything that is RECOMMENDED by <span class="ref"><link url="https://xmpp.org/extensions/xep-0434.html">Trust Messages (XEP-0434)</link></span> <note>XEP-0434: Trust Messages &lt;<link url="https://xmpp.org/extensions/xep-0434.html">https://xmpp.org/extensions/xep-0434.html</link>&gt;.</note> MUST be applied.
		Trust Message URIs as specified by <span class="ref"><link url="https://xmpp.org/extensions/xep-0434.html">Trust Messages (XEP-0434)</link></span> <note>XEP-0434: Trust Messages &lt;<link url="https://xmpp.org/extensions/xep-0434.html">https://xmpp.org/extensions/xep-0434.html</link>&gt;.</note> SHOULD be used for the initial authentications.
	</p>
	<p>
		The examples contain <span class="ref"><link url="https://xmpp.org/extensions/xep-0384.html">OMEMO Encryption (XEP-0384)</link></span> <note>XEP-0384: OMEMO Encryption &lt;<link url="https://xmpp.org/extensions/xep-0384.html">https://xmpp.org/extensions/xep-0384.html</link>&gt;.</note> as the encryption protocol because it uses one key per endpoint of the same identity.
		Nevertheless, other encryption protocols MAY be used as stated in <span class="ref"><link url="https://xmpp.org/extensions/xep-0434.html">Trust Messages (XEP-0434)</link></span> <note>XEP-0434: Trust Messages &lt;<link url="https://xmpp.org/extensions/xep-0434.html">https://xmpp.org/extensions/xep-0434.html</link>&gt;.</note>.
	</p>
	<p>
		If the encryption protocol used with ATM involves only one key for all endpoints of the same identity, only the use cases for authenticating and distrusting keys of a contact's endpoint are relevant.
		Those use cases are marked with OOK for <em>only one key</em>.
		Additionally, the trust messages are always sent to own endpoints because they use the same key as the sending endpoint.
		Therefore, the parts <em>..., to each (other) own endpoint with an already authenticated key.</em> and <em>... as soon as X authenticated Y's key</em> are not of interest.
	</p>
	<p>
		Note that the examples in the following use cases are consecutive and therefore must be read chronologically to properly understand them.
		Since ATM uses <span class="ref"><link url="https://xmpp.org/extensions/xep-0420.html">Stanza Content Encryption (XEP-0420)</link></span> <note>XEP-0420: Stanza Content Encryption &lt;<link url="https://xmpp.org/extensions/xep-0420.html">https://xmpp.org/extensions/xep-0420.html</link>&gt;.</note>, only the SCE <![CDATA[<envelope/>]]> elements are shown.
	</p>
	<p>
		Alice would like to use OMEMO when communicating with Bob.
		Alice has the endpoints A1, A2 and A3.
		Bob has the endpoint B1.
		A1 has already authenticated A2's key.
		The other endpoints have not authenticated each other's key.
	</p>
	<section2 topic="Authenticating the Key of a Contact's Endpoint" anchor="use-case-authentication-contact-endpoint">
		<section3 topic="Sending" anchor="use-case-authentication-contact-endpoint-sending">
			<p>
				Example:
				Remember that A1 has already authenticated A2's key.
				A1 authenticates B1's key.
			</p>
			<p>
				An endpoint that initially authenticates the key of a contact's endpoint MUST send an authentication message for ...
			</p>
			<section4 topic="To Own Endpoints (OOK)" anchor="use-case-authentication-contact-endpoint-sending-to-own-endpoints">
				<p>
					... the key that has been authenticated, to each own endpoint with an already authenticated key.
				</p>
				<example caption="A1 sends an authentication message for B1's key to A2"><![CDATA[
<envelope xmlns=']]>urn:xmpp:sce:1<![CDATA['>
  <rpad>QHqW2arWFewoERL1a43wonBKpTmsrBWnc1d66HSDq85NgMLmjrDJV9lV</rpad>
  <time stamp='2020-01-01T12:00:00'/>
  <from jid='alice@example.org/A1'/>
  <to jid='alice@example.org'/>
  <content>
    <trust-message xmlns=']]>urn:xmpp:tm:1<![CDATA[' usage=']]>urn:xmpp:atm:1<![CDATA[' encryption=']]>urn:xmpp:omemo:2<![CDATA['>
      <key-owner jid='bob@example.com'>
        <trust>YjVI04NcbTPvXLaA95RO84HPcSvyOgEZ2r5cTyUs0C8=</trust>
      </key-owner>
    </trust-message>
  </content>
</envelope>
]]></example>
			</section4>
			<section4 topic="To Contact's Endpoint" anchor="use-case-authentication-contact-endpoint-sending-to-contact-endpoint">
				<p>
					... each already authenticated key of all own endpoints, to the endpoint whose key has been authenticated.
				</p>
				<example caption="A1 sends an authentication message for A2's key to B1"><![CDATA[
<envelope xmlns=']]>urn:xmpp:sce:1<![CDATA['>
  <rpad>Wvj25aDkNbAnSxMIDQo1pjIKRowIMGrF72hSJeXS</rpad>
  <time stamp='2020-01-01T12:00:01'/>
  <from jid='alice@example.org/A1'/>
  <to jid='bob@example.com'/>
  <content>
    <trust-message xmlns=']]>urn:xmpp:tm:1<![CDATA[' usage=']]>urn:xmpp:atm:1<![CDATA[' encryption=']]>urn:xmpp:omemo:2<![CDATA['>
      <key-owner jid='alice@example.org'>
        <trust>aFABnX7Q/rbTgjBySYzrT2FsYCVYb49mbca5yB734KQ=</trust>
      </key-owner>
    </trust-message>
  </content>
</envelope>
]]></example>
			</section4>
		</section3>
		<section3 topic="Receiving" anchor="use-case-authentication-contact-endpoint-receiving">
			<p>
				An endpoint that receives an authentication message for a key of a contact's endpoint from ...
			</p>
			<section4 topic="From Own Endpoint (OOK)" anchor="use-case-authentication-contact-endpoint-receiving-from-own-endpoint">
				<p>
					 ... an own endpoint ...
				</p>
				<p>
					Example:
					A2 authenticates B1's key by the authentication message from A1 (see <link url="#example-1">Example 1</link> for the corresponding authentication message) as soon as A2 authenticated A1's key.
				</p>
			</section4>
			<section4 topic="From Contact's Endpoint" anchor="use-case-authentication-contact-endpoint-receiving-from-contact-endpoint">
				<p>
					... or another endpoint of that contact ...
				</p>
				<p>
					Example:
					B1 authenticates A2's key by the authentication message from A1 (see <link url="#example-2">Example 2</link> for the corresponding authentication message) as soon as B1 authenticated A1's key.
				</p>
			</section4>
			<p>
				... MUST authenticate the key as soon as the receiving endpoint authenticated the key of the endpoint that sent the authentication message.
			</p>
		</section3>
	</section2>
	<section2 topic="Authenticating the Key of an Own Endpoint" anchor="use-case-authentication-own-endpoint">
		<section3 topic="Sending" anchor="use-case-authentication-own-endpoint-sending">
			<p>
				Example:
				Remember that A2 has already authenticated A1's and B1's key.
				A2 authenticates A3's key.
			</p>
			<p>
				An endpoint that initially authenticates the key of an own endpoint MUST send an authentication message for ...
			</p>
			<section4 topic="To All Other Endpoints" anchor="use-case-authentication-own-endpoint-sending-to-other-endpoints">
				<p>
					... the key that has been authenticated to each other endpoint with an already authenticated key.
				</p>
				<example caption="A2 sends an authentication message for A3's key to B1 and by using Message Carbons also to A1"><![CDATA[
<envelope xmlns=']]>urn:xmpp:sce:1<![CDATA['>
  <rpad>O2vRKkmtsXsKSk2hPDkrpQQ4Og272qFGB1Srp64vaDrMTNhrV6</rpad>
  <time stamp='2020-01-01T14:00:01'/>
  <from jid='alice@example.org/A2'/>
  <to jid='bob@example.com'/>
  <content>
    <trust-message xmlns=']]>urn:xmpp:tm:1<![CDATA[' usage=']]>urn:xmpp:atm:1<![CDATA[' encryption=']]>urn:xmpp:omemo:2<![CDATA['>
      <key-owner jid='alice@example.org'>
        <trust>IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA=</trust>
      </key-owner>
    </trust-message>
  </content>
</envelope>
]]></example>
				<example caption="A2 would send an authentication message for A3's key only to A1 if there were no contacts with authenticated keys"><![CDATA[
<envelope xmlns=']]>urn:xmpp:sce:1<![CDATA['>
  <rpad>s5jP95kvpRNg92XLLo8OkLCvUDT53S</rpad>
  <time stamp='2020-01-01T14:00:00'/>
  <from jid='alice@example.org/A2'/>
  <to jid='alice@example.org'/>
  <content>
    <trust-message xmlns=']]>urn:xmpp:tm:1<![CDATA[' usage=']]>urn:xmpp:atm:1<![CDATA[' encryption=']]>urn:xmpp:omemo:2<![CDATA['>
      <key-owner jid='alice@example.org'>
        <trust>IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA=</trust>
      </key-owner>
    </trust-message>
  </content>
</envelope>
]]></example>
			</section4>
			<section4 topic="To Endpoint Whose Key Has Been Authenticated" anchor="use-case-authentication-own-endpoint-sending-to-endpoint-key-authenticated">
				<p>
					... each already authenticated key of all endpoints to the endpoint whose key has been authenticated.
				</p>
				<example caption="A2 sends an authentication message for A1's and B1's key to A3"><![CDATA[
<envelope xmlns=']]>urn:xmpp:sce:1<![CDATA['>
  <rpad>98WA6U92twcVkAXM44UU</rpad>
  <time stamp='2020-01-01T14:00:02'/>
  <from jid='alice@example.org/A2'/>
  <to jid='alice@example.org'/>
  <content>
    <trust-message xmlns=']]>urn:xmpp:tm:1<![CDATA[' usage=']]>urn:xmpp:atm:1<![CDATA[' encryption=']]>urn:xmpp:omemo:2<![CDATA['>
      <key-owner jid='alice@example.org'>
        <trust>883dkfJVAmUkg74v1fqqoA+AhorA1R1+67GwijiS4z0=</trust>
      </key-owner>
      <key-owner jid='bob@example.com'>
        <trust>YjVI04NcbTPvXLaA95RO84HPcSvyOgEZ2r5cTyUs0C8=</trust>
      </key-owner>
    </trust-message>
  </content>
</envelope>
]]></example>
			</section4>
		</section3>
		<section3 topic="Receiving" anchor="use-case-authentication-own-endpoint-receiving">
			<p>
				An endpoint that receives an authentication message for a key of an own endpoint from another own endpoint MUST authenticate the key as soon as the receiving endpoint authenticated the key of the endpoint that sent the authentication message.
			</p>
			<p>
				Example:
				A1 authenticates A3's key by the authentication message from A2 (see <link url="#example-3">Example 3</link> or <link url="#example-4">Example 4</link> for the corresponding authentication message) as soon as A1 authenticated A2's key.
			</p>
		</section3>
	</section2>
	<section2 topic="Distrusting the Key of an Own Endpoint" anchor="use-case-distrusting-own-endpoint">
		<section3 topic="Sending" anchor="use-case-distrusting-own-endpoint-sending">
			<p>
				Example:
				Remember that A1 has already authenticated A2's, A3's and B1's key.
				A1 distrusts A3's key.
			</p>
			<p>
				An endpoint that initially distrusts the key of an own endpoint MUST send a distrust message for that key to each other endpoint with an already authenticated key.
			</p>
			<example caption="A1 sends a distrust message for A3's key to B1 and by using Message Carbons also to A2"><![CDATA[
<envelope xmlns=']]>urn:xmpp:sce:1<![CDATA['>
  <rpad>NF5MOJdt8TBbItt4AHXOUKWncRmw5B</rpad>
  <time stamp='2020-01-01T16:00:01'/>
  <from jid='alice@example.org/A1'/>
  <to jid='bob@example.com'/>
  <content>
    <trust-message xmlns=']]>urn:xmpp:tm:1<![CDATA[' usage=']]>urn:xmpp:atm:1<![CDATA[' encryption=']]>urn:xmpp:omemo:2<![CDATA['>
      <key-owner jid='alice@example.org'>
        <distrust>IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA=</distrust>
      </key-owner>
    </trust-message>
  </content>
</envelope>
]]></example>
			<example caption="A1 would send a distrust message for A3's key only to A2 if there were no contacts with authenticated keys"><![CDATA[
<envelope xmlns=']]>urn:xmpp:sce:1<![CDATA['>
  <rpad>798BFSTQqPjVtiLok3EGtQ7VgB3GGP7eT9P4FhO5</rpad>
  <time stamp='2020-01-01T16:00:00'/>
  <from jid='alice@example.org/A1'/>
  <to jid='alice@example.org'/>
  <content>
    <trust-message xmlns=']]>urn:xmpp:tm:1<![CDATA[' usage=']]>urn:xmpp:atm:1<![CDATA[' encryption=']]>urn:xmpp:omemo:2<![CDATA['>
      <key-owner jid='alice@example.org'>
        <distrust>IhpPjiKLchgrAG5cpSfTvdzPjZ5v6vTOluHEUehkgCA=</distrust>
      </key-owner>
    </trust-message>
  </content>
</envelope>
]]></example>
		</section3>
		<section3 topic="Receiving" anchor="use-case-distrusting-own-endpoint-receiving">
			<p>
				An endpoint that receives a distrust message for a key of an own endpoint from another own endpoint MUST distrust the key as soon as the receiving endpoint authenticated the key of the endpoint that sent the distrust message.
			</p>
			<p>
				Example:
				A2 distrusts A3's key by the distrust message from A1 (see <link url="#example-6">Example 6</link> or <link url="#example-7">Example 7</link> for the corresponding distrust message) as soon as A2 authenticated A1's key.
			</p>
		</section3>
	</section2>
	<section2 topic="Distrusting the Key of a Contact's Endpoint" anchor="use-case-distrusting-contact-endpoint">
		<section3 topic="Sending (OOK)" anchor="use-case-distrusting-contact-endpoint-sending">
			<p>
				Example:
				Remember that A1 has already authenticated A2's and B1's key but distrusted A3's key.
				A1 distrusts B1's key.
			</p>
			<p>
				An endpoint that distrusts the key of a contact's endpoint MUST send a distrust message for that key to each other own endpoint with an authenticated key.
			</p>
			<example caption="A1 sends a distrust message for B1's key to A2"><![CDATA[
<envelope xmlns=']]>urn:xmpp:sce:1<![CDATA['>
  <rpad>x4LJDawLHgnTJRC7T1mndKEQLPR658NQmXAPQRVnhM1QQ861ve</rpad>
  <time stamp='2020-01-01T18:00:00'/>
  <from jid='alice@example.org/A1'/>
  <to jid='alice@example.org'/>
  <content>
    <trust-message xmlns=']]>urn:xmpp:tm:1<![CDATA[' usage=']]>urn:xmpp:atm:1<![CDATA[' encryption=']]>urn:xmpp:omemo:2<![CDATA['>
      <key-owner jid='bob@example.com'>
        <distrust>YjVI04NcbTPvXLaA95RO84HPcSvyOgEZ2r5cTyUs0C8=</distrust>
      </key-owner>
    </trust-message>
  </content>
</envelope>
]]></example>
		</section3>
		<section3 topic="Receiving" anchor="use-case-distrusting-contact-endpoint-receiving">
			<p>
				An endpoint that receives a distrust message for a key of a contact's endpoint from ...
			</p>
			<section4 topic="From Contact's Endpoint" anchor="use-case-distrusting-contact-endpoint-receiving-from-contact-endpoint">
				<p>
					... another endpoint of that contact ...
				</p>
				<p>
					Example:
					B1 distrusts A3's key by the distrust message from A1 (see <link url="#example-6">Example 6</link> for the corresponding distrust message) as soon as B1 authenticated A1's key.
				</p>
			</section4>
			<section4 topic="From Own Endpoint (OOK)" anchor="use-case-distrusting-contact-endpoint-receiving-from-own-endpoint">
				<p>
					 ... or an own endpoint ...
				</p>
				<p>
					Example:
					A2 distrusts B1's key by the distrust message from A1 (see <link url="#example-8">Example 8</link>) as soon as A2 authenticated A1's key.
				</p>
			</section4>
			<p>
				... MUST distrust the key as soon as the receiving endpoint authenticated the key of the endpoint that sent the distrust message.
			</p>
		</section3>
	</section2>
</section1>
<section1 topic="Implementation Notes" anchor="implementation-notes">
	<section2 topic="Storing Trust Message Information from Endpoints with Unauthenticated Keys" anchor="implementation-notes-storing-trust-message-information-unauthenticated-keys">
		<p>
			A client MUST save the information of a trust message until the key of the endpoint that sent the trust message is authenticated, so that the key can then be authenticated or distrusted.
			Storing data of a trust message from an endpoint with an unauthenticated key is necessary because the receiving endpoint can only use that data after authenticating the sending endpoint's key and that data might not be received again.
			Afterwards the information of the trust message MAY be deleted.
		</p>
		<p>
			Example:
			When Alice's endpoint A1 authenticates the key of Bob's endpoint B1, A1 sends a trust message containing the keys of Alice's other endpoint A2 to B1.
			If B1 has not already authenticated A1's key, B1 stores the information provided by the trust message.
			B1 authenticates A1's key and is then able to automatically authenticate A2's key.
		</p>
	</section2>
	<section2 topic="Storing Trust Message Information for Unknown Keys" anchor="implementation-notes-storing-trust-message-information-unknown-keys">
		<p>
			A client MUST save the information of a trust message until it has fetched the corresponding key so that the key can then be authenticated or distrusted.
			Afterwards the information of the trust message can be deleted.
		</p>
		<p>
			Example:
			Alice's endpoint A1 receives an authentication message from Bob's endpoint B1.
			That authentication message contains the key for Bob's other endpoint B2.
			If A1 has not already fetched B2's key, A1 stores the information provided by the trust message.
			A1 fetches B2's key and is then able to automatically authenticate A2's key.
		</p>
	</section2>
	<section2 topic="GUI Considerations" anchor="implementation-notes-gui-considerations">
		<p>
			A client that receives a trust message SHOULD NOT display its bare content to the user.
			Instead, the trust message SHOULD be hidden and the automatic authentication or distrusting SHOULD take place in the background.
		</p>
	</section2>
</section1>
<section1 topic="Security Considerations" anchor="security-considerations">
	<section2 topic="Notification and Confirmation" anchor="security-considerations-notification-and-confirmation">
		<p>
			After a successful authentication or distrusting, the user MAY be informed of that event.
			The client MAY offer an option for requesting the user's confirmation before any automatic authentication or automatic distrusting is performed.
		</p>
	</section2>
	<section2 topic="Recommended Security Policy - Trust Only Authenticated Keys After First Authentication (TOAKAFA)" anchor="security-considerations-recommended-security-policy-trust-only-authenticated-keys-after-first-authentication-toakafa">
		<p>
			It is more secure to be protected against passive attacks instead of not using any encryption.
			If it is not possible to authenticate a key before encrypting with it but it is desired to communicate with the key's endpoint, it is RECOMMENDED to automatically trust new keys until the first authentication has been made.
		</p>
		<p>
			Even ATM cannot protect the user against an attacker with an automatically trusted and undetected malicious key.
			For this reason it is important to take special care of the following security aspects.
		</p>
		<p>
			If keys are automatically trusted until the first authentication, keys that are not authenticated by then SHOULD NOT be used any longer for encryption until they have been authenticated too.
			New keys SHOULD also only be used for encryption after they have been authenticated.
			Without these two additional precautions it is not possible to protect the user against attackers who introduced malicious keys before or after the first authentication.
		</p>
	</section2>
</section1>
<section1 topic="IANA Considerations" anchor="iana-considerations">
	<p>
		This document requires no interaction with the Internet Assigned Numbers Authority (IANA).
	</p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor="registrar">
	<section2 topic="Protocol Namespaces" anchor="xmpp-registrar-considerations-protocol-namespaces">
		<p>
			This specification defines the following XMPP namespaces:
		</p>
		<ul>
			<li>urn:xmpp:atm:1</li>
		</ul>
	</section2>
	<section2 topic="Protocol Versioning" anchor="xmpp-registrar-considerations-protocol-versioning">
		<p>If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of <cite>XEP-0053</cite>.</p>
	</section2>
</section1>
</xep>
