Evan Prodromou
This document discusses several abstract protocols for end-to-end encrypted messaging (E2EE) in ActivityPub. It then maps each abstract protocol into Activity Streams 2.0 (AS2) data structures as well as the ActivityPub (AP) API and federation protocol. Finally, it discusses pros and cons of each protocol for implementing E2EE in ActivityPub.
The OpenPGP Message Format is a standard for encrypting and signing messages using various encryption algorithms.
RFC 3156 (“MIME Security with OpenPGP”) defines a way to embed OpenPGP messages into MIME messages. It provides a content type for OpenPGP messages, application/pgp-encrypted
.
Together, these RFCs help people send end-to-end encrypted email. They can be adapted for use in ActivityPub.
Text-oriented ActivityPub object types, like Note
and Article
can have a mediaType
property that determines the Internet media type of the content
property. An implementation can use the application/pgp-encrypted
media type for encrypted messages.
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Note",
"id": "https://example.com/notes/1",
"attributedTo": "https://example.com/users/evan",
"to": ["https://example.com/users/alice"],
"mediaType": "application/pgp-encrypted",
"content": "<OpenPGP encrypted message>",
"published": "2024-06-14T00:00:00Z"
}
Binary data, such as images, can be embedded directly into the content
property of an ActivityPub object.
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Image",
"id": "https://example.com/image/1",
"attributedTo": "https://example.com/users/evan",
"to": ["https://example.com/users/alice"],
"mediaType": "application/pgp-encrypted",
"content": "<OpenPGP encrypted image data>",
"published": "2024-06-14T00:00:00Z"
}
Alternately, the binary data can be uploaded separately and referenced by URL.
{
"@context": "https://www.w3.org/ns/activitystreams",
"type": "Image",
"id": "https://example.com/image/1",
"attributedTo": "https://example.com/users/evan",
"to": ["https://example.com/users/alice"],
"url": {
"type": "Link",
"mediaType": "application/pgp-encrypted",
"href": "https://example.com/image/1.jpg.pgp"
},
"published": "2024-06-14T00:00:00Z"
}
Well-behaved ActivityPub servers should be able to handle this form of encrypted message and route them to the correct recipient.
Clients that don’t support OpenPGP can’t read the encrypted content. They will see the encrypted content as plain text. This is not ideal, but also does not leak the content.
Most of the architecture variations can work with this method.
mediaType
property might show the encrypted content as plain text.Signal is a protocol developed by the Signal Foundation for end-to-end encrypted messaging. It is used in the Signal messaging app, WhatsApp, Facebook Messenger, Google RCS messages, and other messaging services.
The protocol is not standardized; most implementations use a single implementation, libsignal
, developed by the Signal Foundation. The library is licensed under the Affero General Public License (AGPL) version 3.0.
The Signal messaging system uses gRPC for its transport protocol.
Specifying the Signal protocol layered over ActivityPub will require two main components:
-
The payloads for Activity types need to mirror these libsignal
message types:
Message Layer Security (MLS) is a protocol for end-to-end encrypted messaging. It is implemented by Cisco Webex for their messaging service.
MLS explicitly defines two low-level abstract services: a key store and a message delivery service. These can be implemented on top of various transport protocols, like ActivityPub.
The read-only methods of these services can be implemented as ActivityPub API endpoints, or can use existing endpoints as a fallback. The write methods can be implemented as ActivityPub Activity types, posted to the outbox
endpoint for the actor.
The key store has several responsibilities:
-
The delivery service is required to deliver messages to all members of a group. It can be implemented as a set of custom Activity types on top of ActivityPub.