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.
ATM reduces the steps needed for authenticating or distrusting keys of endpoints between two identities (XMPP accounts / bare JIDs). It uses Trust Messages (XEP-0434)  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.
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 OMEMO Encryption (XEP-0384)  which use one key per endpoint of the same identity.
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.
The network of endpoints which 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.
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.
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.
Everything which is RECOMMENDED by Trust Messages (XEP-0434)  MUST be applied.
The examples contain OMEMO Encryption (XEP-0384)  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 Trust Messages (XEP-0434) .
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 only one key. Additionally, the trust messages are always sent to own endpoints because they use the same key as the sending endpoint. Therefore, the parts ..., to each (other) own endpoint with an already authenticated key. and ... as soon as X authenticated Y's key are not of interest.
Note that the examples in the following use cases are consecutive and therefore must be read chronologically to properly understand them. Since ATM uses Stanza Content Encryption (XEP-0420) , only the SCE <content/> elements are shown.
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.
Example: Remember that A1 has already authenticated A2's key. A1 authenticates B1's key.
An endpoint which initially authenticates the key of a contact's endpoint MUST send an authentication message for ...
... the key that has been authenticated, to each own endpoint with an already authenticated key.
... each already authenticated key of all own endpoints, to the endpoint whose key has been authenticated.
An endpoint which receives an authentication message for a key of a contact's endpoint from ...
... an own endpoint ...
Example: A2 authenticates B1's key by the authentication message from A1 (see Example 1 for the corresponding authentication message) as soon as A2 authenticated A1's key.
... or another endpoint of that contact ...
Example: B1 authenticates A2's key by the authentication message from A1 (see Example 2 for the corresponding authentication message) as soon as B1 authenticated A1's key.
... MUST authenticate the key as soon as the receiving endpoint authenticated the key of the endpoint which sent the authentication message.
Example: Remember that A2 has already authenticated A1's and B1's key. A2 authenticates A3's key.
An endpoint which initially authenticates the key of an own endpoint MUST send an authentication message for ...
... the key that has been authenticated to each other endpoint with an already authenticated key.
... each already authenticated key of all endpoints to the endpoint whose key has been authenticated.
An endpoint which 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 which sent the authentication message.
Example: Remember that A1 has already authenticated A2's, A3's and B1's key. A1 distrusts A3's key.
An endpoint which 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.
An endpoint which 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 which sent the distrust message.
Example: Remember that A1 has already authenticated A2's and B1's key but distrusted A3's key. A1 distrusts B1's key.
An endpoint which 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.
An endpoint which receives a distrust message for a key of a contact's endpoint from ...
... another endpoint of that contact ...
Example: B1 distrusts A3's key by the distrust message from A1 (see Example 6 for the corresponding distrust message) as soon as B1 authenticated A1's key.
... or an own endpoint ...
Example: A2 distrusts B1's key by the distrust message from A1 (see Example 8) as soon as A2 authenticated A1's key.
... MUST distrust the key as soon as the receiving endpoint authenticated the key of the endpoint which sent the distrust message.
A client MUST save the information of a trust message until the key of the endpoint which sent the trust message is authenticated, so that the key can then be authenticated or revoked. 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.
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.
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 revoked. Afterwards the information of the trust message can be deleted.
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.
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.
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.
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.
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.
If keys are automatically trusted until the first authentication, keys which 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.
This document requires no interaction with the Internet Assigned Numbers Authority (IANA).
This specification defines the following XMPP namespaces:
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 XEP-0053.
This document in other formats: XML PDF
This XMPP Extension Protocol is copyright © 1999 – 2020 by the XMPP Standards Foundation (XSF).
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.
## 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. ##
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.
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 <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.
The primary venue for discussion of XMPP Extension Protocols is the <email@example.com> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.
Errata can be sent to <firstname.lastname@example.org>.
The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/