Daily Mail PH

Wednesday, June 5, 2024

Towards Federated Key Transparency

In late 2022, I blogged about the work needed to develop a specification for end-to-end encryption for the fediverse. I sketched out some of the key management components on GitHub, and then the public work abruptly stalled. A few of you have wondere…
Read on blog or Reader
Site logo image Dhole Moments Read on blog or Reader

Towards Federated Key Transparency

Soatok

June 6

In late 2022, I blogged about the work needed to develop a specification for end-to-end encryption for the fediverse. I sketched out some of the key management components on GitHub, and then the public work abruptly stalled.

A few of you have wondered what's the deal with that.

This post covers why this effort stalled, what I'm proposing we do next.

What's The Hold Up?

The "easy" (relatively speaking) parts of the problem are as follows:

  1. Secret key management. (This is sketched out already, and provides multiple mechanisms for managing secret key material. Yay!)
  2. Bulk encryption of messages and media. (I've done a lot of work in this space over the years, so it's an area I'm deeply familiar with. When we get to this part, it will be almost trivial. I'm not worried about it at all.)
  3. Forward-secure ratcheting / authenticated key exchange / group key agreement. (RFC 9420 is a great starting point.)

That is to say, managing secret keys, using secret keys, and deriving shared secret keys are all in the "easy" bucket.

The hard part? Public key management.

Blue Screen of Death Sticker
CMYKat made this

Why is Public Key Management Hard?

In a centralized service (think: BlueSky, Twitter, Facebook, etc.), this is actually much easier to build: Shove your public keys into a database, and design your client-side software to trust whatever public key your server gives them. Bob's your uncle, pack it up and go home.

Unfortunately, it's kind of stupid to build anything that way.

If you explicitly trust the server, the server could provide the wrong public key (i.e., one for which the server knows the corresponding secret key) and you'll be none the wiser. This makes it trivial for the server to intercept and read your messages.

If your users are trusting you regardless, they're probably just as happy if you don't encrypt at the endpoint at all (beyond using TLS, but transport encryption is table stakes for any online service so nevermind that).

But let's say you wanted to encrypt between peers anyway, because you're feeling generous (or don't want to field a bunch of questionably legal demands for user data by law enforcement; a.k.a. the Snapchat threat model).

You could improve endpoint trust by shoving all of your users' public keys into an append-only data structure; i.e. key transparency, like WhatsApp proposed in 2023:

And, to be perfectly clear, key transparency is a damn good idea.

Key transparency keeps everyone honest and makes it difficult for criminals to secretly replace a victim's public key, because the act of doing so is unavoidably published to an append-only log.

The primary challenge is scaling a transparency feature to serve a public, federated system.

AJ

Federated Key Transparency?

Despite appearances, I haven't been sitting on my thumbs for the past year or so. I've been talking with cryptography experts about their projects and papers in the same space.

Truthfully, I had been hoping to piggyback off one of those upcoming projects (which is focused more on public key discovery for SAML- and OAuth-like protocols) to build the Federated PKI piece for E2EE for the Fediverse.

Unfortunately, that project keeps getting delayed and pushed back, and I've just about run out of patience for it.

Additionally, there are some engineering challenges that I would need to tackle to build atop it, so it's not as simple as "let's just use that protocol", either.

So let's do something else instead:

Art: ScruffKerfluff

Fediverse Public Key Directories

Orthogonal to the overall Fediverse E2EE specification project, let's build a Public Key Directory for the Fediverse.

This will not only be useful for building a coherent specification for E2EE (as it provides the "Federated PKI" component we'd need to build it securely), but it would also be extremely useful for software developers the whole world over.

Imagine this:

  • If you want to fetch a user's SSH public key, you can just query for their username and get a list of non-expired, non-revoked public keys to choose from.
  • If you wanted public key pinning and key rotation for OAuth2 and/or OpenID Connect identity providers without having to update configurations or re-deploy any applications, you can do that.
  • If you want to encrypt a message to a complete stranger, such that only they can decrypt it, without any sort of interaction (i.e., they could be offline for a holiday and still decrypt it when they get back), you could do that.

Oh, and best of all? You can get all these wins without propping up any cryptocurrency bullshit either.

From simple abstractions, great power may bloom.

Mark Miller

How Will This Work?

We need to design a specific kind of server that speaks a limited set of the ActivityPub protocol.

I say "limited" because it will only not support editing or deleting messages provided by another instance. It will only append data.

To understand the full picture, let's first look at the message types, public key types, and how the message types will be interpreted.

Message Types

Under the ActivityPub layer, we will need to specify a distinct set of Directory Message Types. An opening offer would look like this:

  1. AddKey -- contains an Asymmetric Public Key, the user and instance that hosts it, and other metadata
  2. RevokeKey -- marks an existing public key as revoked
  3. MoveIdentity -- moves all of the public keys from identity A to identity B. This can be used for username changes or instance migrations.

We may choose to allow more message types at the front-end if need be, but that's enough for our purposes.

Public Key Types

We are not interested in backwards compatibility with every existing cryptosystem. We will only tolerate a limited set of public key types.

At the outset, only Ed25519 will be supported.

In the future, we will include post-quantum digital signature algorithms on this list, but not before the current designs have had time to mature.

RSA will never be included in the set.

ECDSA over NIST P-384 may be included at some point, if there's sufficient interest in supporting e.g., US government users.

If ECDSA is ever allowed, RFC 6979 is mandatory.

Message Processing

When an instance sends a message to a Directory Server, it will need to contain a specific marker for our protocol. Otherwise, it will be rejected.

Each message will have its own processing rules.

After the processing rules are applied, the message will be stored in the Directory Server, and a hash of the message will be published to a SigSum transparency ledger. The Merkle root and inclusion proofs will be stored in an associated record, attached to the record for the new message.

Every message will have its hash published in SigSum. No exceptions.

We will also need a mechanism for witness co-signatures to be published and attached to the record.

AddKey
 {   "@context": "https://example.com/ns/fedi-e2ee/v1",   "action": "AddKey",   "message": {     "time": "2024-12-31T23:59:59Z",     "identity": "foo@mastodon.example.com",     "public-key": "ed25519:<key goes here>"   },   "signature": "SignatureOfMessage" } 

The first AddKey for any given identity will need to be self-signed by the key being added (in addition to ActivityPub messages being signed by the instance).

After an identity exists in the directory, every subsequent public key MUST be signed by a non-revoked keypair.

RevokeKey
 {   "@context": "https://example.com/ns/fedi-e2ee/v1",   "action": "RevokeKey",   "message": {     "time": "2024-12-31T23:59:59Z",     "identity": "foo@mastodon.example.com",     "public-key": "ed25519:<key goes here>"   },   "signature": "SignatureOfMessage" } 

This marks the public key as untrusted, and effectively "deletes" it from the list that users will fetch.

Important: RevokeKey will fail unless there is at least one more trusted public key for this user. Otherwise, a denial of service would be possible.

Replaying an AddKey for a previously-revoked key MUST fail.

MoveIdentity
 {   "@context": "https://example.com/ns/fedi-e2ee/v1",   "action": "MoveIdentity",   "message": {     "time": "2024-12-31T23:59:59Z",     "old-identity": "foo@mastodon.example.com",     "new-identity": "bar@akko.example.net"   },   "signature": "SignatureOfMessage" } 

This exists to facilitate migrations and username changes.

Fetching Public Keys

A simple JSON API (and/or an ActivityStream; haven't decided) will be exposed to query for the currently trusted public keys for a given identity.

 {   "@context": "https://example.com/ns/fedi-e2ee/v1",   "public-keys": [     {       "data": {         "time": "2024-12-31T23:59:59Z",         "identity": "foo@mastodon.example.com",         "public-key": "ed25519:<key goes here>"       },       "signature": "SignatureOfData",       "sigsum": { /* ... */ },     }, {       "data": {         /* ... */       },       /* ... */     },     /* ... */   ] } 

Simple and easy.

Drakeposting Yes Sticker
CMYKat

Gossip Between Instances

Directory Servers should be configurable to mirror records from other instances.

Additionally, they should be configurable to serve as Witnesses for the SigSum protocol.

The communication layer here between Directory Servers will also be ActivityPub.

Preventing Abuse

The capability of learning a user's public key doesn't imply the ability to send messages or bypass their block list.

Additionally, Fediverse account usernames are (to my knowledge) generally not private, so I don't anticipate there being any danger in publishing public keys to an append-only ledger.

That said, I am totally open to considering use cases where the actual identity is obfuscated (e.g., HMAC with a static key known only to the instance that hosts them instead of raw usernames).

How Will This Be Used for E2EE Direct Messaging?

I anticipate that a small pool of Directory Servers will be necessary, due to only public keys and identities being stored.

Additional changes beyond just the existence of Directory Servers will need to be made to facilitate private messaging. Some of those changes include:

  • Some endpoint for users to know which Directory Servers a given ActivityPub instance federates with (if any).
  • Some mechanism for users to asynchronously exchange Signed Pre-Key bundles for initiating contact. (One for users to publish new bundles, another for users to retrieve a bundle.)
    • These will be Ed25519-signed payloads containing an ephemeral X25519 public key.

This is all outside the scope of the proposal I'm sketching out here today, but it's worth knowing that I'm aware of the implementation complexity.

The important thing is: I (soatok@furry.engineer) should be able to query pawb.fun, find the Directory Server(s) they federate with, and then query that Directory server for Crashdoom@pawb.fun and get his currently trusted Ed25519 public keys.

From there, I can query pawb.fun for a SignedPreKey bundle, which will have been signed by one of those public keys.

And then we can return to the "easy" pile.

Soatok holding his arms out at eye level, a rainbow springing forth from his palms over his head. Hie eyes are big and watery. His maw is open, and rainbow drool is coming out. His arms have rainbow sleeves. This is the gayest sticker I own. Happy Pride month!
MarleyTanuki

Development Plan

Okay, so that was a lot of detail, and yet not enough detail, depending on who's reading this blog post.

What I wrote here today is a very rough sketch. The devil is always in the details, especially with cryptography.

Goals and Non-Goals

We want Fediverse users to be able to publish a public key that is bound to their identity, which anyone else on the Internet can fetch and then use for various purposes.

We want to leverage the existing work into key transparency by the cryptography community.

We don't want to focus on algorithm agility or protocol compatibility.

Tasks

The first thing we would need to do is write a formal specification for a Directory Server (whose job is only to vend Public Keys in an auditable, transparent manner).

Next, we need to actually build a reference implementation of this server, test it thoroughly, and then have security experts pound at the implementation for a while. Any security issues that can be mitigated by design will require a specification update.

We will NOT punt these down to implementors to be responsible for, unless we cannot avoid doing so.

Once these steps are done, we can start rolling the Directory Servers out. At this point, we can develop client-side libraries in various programming languages to make it easy for developers to adopt.

My continued work on the E2EE specification for the Fediverse can begin after we have an implementation of the Directory Server component ready to go.

Timeline

I have a very demanding couple of months ahead of me, professionally, so I don't yet know when I can commit to starting the Fediverse Directory Server specification work.

Strictly speaking, it's vaguely possible to get buy-in from work to focus on this project as part of my day-to-day responsibilities, since it has immediate and lasting value to the Internet.

However, I don't want to propose it because that would be crossing the professional-personal streams in a way I'm not really comfortable with.

The last thing I need is angry Internet trolls harassing my coworkers to try to get under my fur, y'know?

If there is enough interest from the broader Fediverse community, I'm also happy to delegate this work to anyone interested.

Once the work can begin, I don't anticipate it will take more than a week for me to write a specification that other crypto nerds will take seriously.

I am confident in this because most of the cryptography will be constrained to hash functions, preventing canonicalization and cross-protocol attacks, and signatures.

Y'know, the sort of thing I write about on my furry blog for fun!

Building a reference implementation will likely take a bit longer; if, for no other reason, than I believe it would be best to write it in Go (which has the strongest SigSum support, as of this writing).

This is a lot of words to say, as far as timelines go:

I dunno lol
CMYKat

How to Get Involved

Regardless of whether my overall E2EE proposal gets adopted, the Directory Server component is something that should be universally useful to the Fediverse and to software developers around the world.

If you are interested in participating in any technical capacity, I have just created a Signal Group for discussing and coordinating efforts.

Can I Contribute Non-Technically?

Yes, absolutely. In the immediate future, once it kicks off, the work is going to be technology-oriented.

However, we may need people with non-technical skills at some point, so feel free to dive in whenever you feel comfortable.

What About Financially?

If you really have money burning a hole in your pocket and want to toss a coin my way, I do have a Ko-Fi. Do not feel pressured at all to do so, however.

Because I only use Ko-Fi as a tip jar, rather than as a business, I'm not specifically tracking which transaction is tied to which project, so I can't make any specific promises about how any of the money sent my way will be allocated.

What I will promise, however, is that any icons/logos/etc. created for this work will be done by an artist and they will be adequately compensated for their work. I will not use large-scale computing (a.k.a., "Generative AI") for anything.

Closing Thoughts

What I've sketched here is much simpler (and more ActivityPub-centric) than the collaboration I was originally planning.

Thanks for being patient while I tried, in vain, to make that work.

As of today, I no longer think we need to wait for them. We can build this ourselves, for each other.

Comment

Dhole Moments © 2024. Manage your email settings or unsubscribe.

WordPress.com and Jetpack Logos

Get the Jetpack app

Subscribe, bookmark, and get real-time notifications - all from one app!

Download Jetpack on Google Play Download Jetpack from the App Store
WordPress.com Logo and Wordmark title=

Automattic, Inc. - 60 29th St. #343, San Francisco, CA 94110  

at June 05, 2024
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

CG BOSS Posts from Gargoyles Reboot thanks to creator kept it alive | CG BOSS Games for 04/26/2026

CG BOSS Blog Post Updates ...

  • [New post] Achieve Data Sovereignty through Omnisphere
    Crypto Breaking News posted: "Web 3.0 is one of the biggest buzzwords flying around the world of social media this year. An...
  • [New post] Tuesday’s politics thread is trying to stay positive.
    SheleetaHam posted: " Even though I just finished the latest Opening Arguments podcast about how Roe v. Wade is toast, and ...
  • How can the Rappler app be better? We'd like to know what you think!
    Hi daily! Have you downloaded the Rappler app? We'd love to hear about ...

Search This Blog

  • Home

About Me

Daily Newsletters PH
View my complete profile

Report Abuse

Labels

  • Last Minute Online News

Blog Archive

  • April 2026 (1)
  • February 2026 (1)
  • January 2026 (7)
  • December 2025 (8)
  • November 2025 (4)
  • October 2025 (2)
  • September 2025 (1)
  • August 2025 (2)
  • July 2025 (5)
  • June 2025 (3)
  • May 2025 (2)
  • April 2025 (2)
  • February 2025 (2)
  • December 2024 (1)
  • October 2024 (2)
  • September 2024 (1459)
  • August 2024 (1360)
  • July 2024 (1614)
  • June 2024 (1394)
  • May 2024 (1376)
  • April 2024 (1440)
  • March 2024 (1688)
  • February 2024 (2833)
  • January 2024 (3130)
  • December 2023 (3057)
  • November 2023 (2826)
  • October 2023 (2228)
  • September 2023 (2118)
  • August 2023 (2611)
  • July 2023 (2736)
  • June 2023 (2844)
  • May 2023 (2749)
  • April 2023 (2407)
  • March 2023 (2810)
  • February 2023 (2508)
  • January 2023 (3052)
  • December 2022 (2844)
  • November 2022 (2673)
  • October 2022 (2196)
  • September 2022 (1973)
  • August 2022 (2306)
  • July 2022 (2294)
  • June 2022 (2363)
  • May 2022 (2299)
  • April 2022 (2233)
  • March 2022 (1993)
  • February 2022 (1358)
  • January 2022 (1323)
  • December 2021 (2064)
  • November 2021 (3141)
  • October 2021 (3240)
  • September 2021 (3135)
  • August 2021 (1782)
  • May 2021 (136)
  • April 2021 (294)
Simple theme. Powered by Blogger.