End-to-end Encryption (E2EE) over ActivityPub
-
Of an envelope. If
actorbeing changed mid-transit isn't a problem, then omit it from the aad. Including thefrom/toas part of the AAD binds the ciphertext to the origin/recipient (the HPKE ciphertext does not carry any of this information).It is worth noting that, as the FEP is specified now, using the sender and recipient's keypairs to do HPKE will result in the same shared secret being generated for every message. This is catastrophic to security as the nonce for the symmetric portion of the HPKE encryption is deterministic (RFC 9180 5.1).
This can be avoided by either: having the sender generate an ephemeral keypair (include the public key envelope), or using a unique HPKE
infoper envelope. The former is better as it gives imperfect forward secrecy (sender identity key compromise does not reveal past plaintexts), the latter is cheaper to do.having the sender generate an ephemeral keypair (include the public key envelope)
So the recipient will need to encrypt to this ephemeral key when replying?
-
having the sender generate an ephemeral keypair (include the public key envelope)
So the recipient will need to encrypt to this ephemeral key when replying?
No, the recipient would also generates an ephemeral key, and uses that when replying.
So it's always a one shot ephemeral (sender)/static (recipient) HPKE exchange, with sender authenticity guaranteed by the signature. Could also use the shared secret from the original post but force a different IV, but "replies are just the sender and receiver being flipped, code path is the same" is easier.
-
No, the recipient would also generates an ephemeral key, and uses that when replying.
So it's always a one shot ephemeral (sender)/static (recipient) HPKE exchange, with sender authenticity guaranteed by the signature. Could also use the shared secret from the original post but force a different IV, but "replies are just the sender and receiver being flipped, code path is the same" is easier.
@greyarea I assume this is "Authentication Using an Asymmetric Key" (https://www.rfc-editor.org/rfc/rfc9180.html#name-authentication-using-an-asy)?
Because in "Encryption to a Public Key" mode, sender's key is not used.
If I understand the idea correctly, the ephemeral key would need to be added to
fep0806:cipherData. That is, instead ofencap_key | ciphertextit will beephemeral_key_pub | encap_key | ciphertext. -
@greyarea I assume this is "Authentication Using an Asymmetric Key" (https://www.rfc-editor.org/rfc/rfc9180.html#name-authentication-using-an-asy)?
Because in "Encryption to a Public Key" mode, sender's key is not used.
If I understand the idea correctly, the ephemeral key would need to be added to
fep0806:cipherData. That is, instead ofencap_key | ciphertextit will beephemeral_key_pub | encap_key | ciphertext.If the signature in
proofcoversfep0806:cipherData, you can doephemeral_key_pub | ciphertext. and useEncryption to a Public Key. -
If the signature in
proofcoversfep0806:cipherData, you can doephemeral_key_pub | ciphertext. and useEncryption to a Public Key.@greyarea Yes,
proofcovers all properties of the activity. But I can't omitencap_key, it is required bySetupBaseRfunction defined in section 5.1.1I've read a bit more about DHKEM and now I am even more confused. Isn't
encap_keyan ephemeral key? The library I am using describes it as such:https://docs.rs/hpke/latest/hpke/trait.Kem.html#tymethod.encap_with_rng
Derives a shared secret and an ephemeral pubkey that the owner of the reciepint’s pubkey can use to derive the same shared secret.
This "ephemeral pubkey" is what I labeled as
encap_key. It is later included infep0806:cipherData-----
I think it's okay to have no forward secrecy, the goal of this FEP is to describe a simple encryption mechanism that anyone can implement. I'll just warn readers about its weakness.
-
@greyarea Yes,
proofcovers all properties of the activity. But I can't omitencap_key, it is required bySetupBaseRfunction defined in section 5.1.1I've read a bit more about DHKEM and now I am even more confused. Isn't
encap_keyan ephemeral key? The library I am using describes it as such:https://docs.rs/hpke/latest/hpke/trait.Kem.html#tymethod.encap_with_rng
Derives a shared secret and an ephemeral pubkey that the owner of the reciepint’s pubkey can use to derive the same shared secret.
This "ephemeral pubkey" is what I labeled as
encap_key. It is later included infep0806:cipherData-----
I think it's okay to have no forward secrecy, the goal of this FEP is to describe a simple encryption mechanism that anyone can implement. I'll just warn readers about its weakness.
Ah , mea culpa, you're right.
5.1.1avoids the nonce reuse issue and provides imperfect forward secrecy. I've been fighting u-boot on "new" exotic target the last day so my thinking isn't as sharp as it should be.Replies should go through the same process (avoids sender having to store the shared secret, less state is more better in this case).
-
Ah , mea culpa, you're right.
5.1.1avoids the nonce reuse issue and provides imperfect forward secrecy. I've been fighting u-boot on "new" exotic target the last day so my thinking isn't as sharp as it should be.Replies should go through the same process (avoids sender having to store the shared secret, less state is more better in this case).
Think
5.1.3(AuthEncap) is better since it still uses an ephemeral key, but does an extra DH to authenticate the sender.5.1.1(Encap) is simpler, but unless the aad contains at least the sender's identity, there is nothing preventing someone from extracting a ciphertext, and re-signing it (forging the origin).Having a trivial amount of AAD is computationally cheaper than doing the extra DH, but the extra DH would be sub 100 usec, so this is "pick something to taste".
ps: Spent the day chasing LLVM bugs, errors in this would be all mine.
-
Think
5.1.3(AuthEncap) is better since it still uses an ephemeral key, but does an extra DH to authenticate the sender.5.1.1(Encap) is simpler, but unless the aad contains at least the sender's identity, there is nothing preventing someone from extracting a ciphertext, and re-signing it (forging the origin).Having a trivial amount of AAD is computationally cheaper than doing the extra DH, but the extra DH would be sub 100 usec, so this is "pick something to taste".
ps: Spent the day chasing LLVM bugs, errors in this would be all mine.
@greyarea Alright, I implemented the auth mode. It's not difficult, but it requires the actor of outer activity to be the same as the actor of inner (plaintext) activity. With base mode (5.1.1), the
actorof outer activity could be different, which means we can hide the real sender.Do you think it's worth doing this?
I think authentication of the sender at the HPKE level shouldn't be necessary because the inner activity is self-authenticating (includes integrity proof).
-
@greyarea Alright, I implemented the auth mode. It's not difficult, but it requires the actor of outer activity to be the same as the actor of inner (plaintext) activity. With base mode (5.1.1), the
actorof outer activity could be different, which means we can hide the real sender.Do you think it's worth doing this?
I think authentication of the sender at the HPKE level shouldn't be necessary because the inner activity is self-authenticating (includes integrity proof).
Do you think it's worth doing this?
Identity hiding is a useful property (especially in the current environment), and simpler is better. Especially if the inner activity is self-authenticating.
ps: I should look more into the fediverse protocol, but from what I remember from peeking at it a long time ago it was a giant mess of w3c specs.
-
Do you think it's worth doing this?
Identity hiding is a useful property (especially in the current environment), and simpler is better. Especially if the inner activity is self-authenticating.
ps: I should look more into the fediverse protocol, but from what I remember from peeking at it a long time ago it was a giant mess of w3c specs.
I can think of two scenarios where HPKE-level sender authentication or
aadbinding might be important:1. The sender creates an activity that is attributed to somebody else, encrypts it, and sends to the recipient. This shouldn't be a problem, because the inner activity MUST be portable, and therefore required to have an integrity proof. A compliant recipient can't be fooled into thinking that misattributed activity is real.
2. Somebody (e.g. server operator) takes thefep0806:cipherTextout ofEncryptedActivity, and creates a new activity with the samefep0806:cipherTextbut differentid,actorand/orto. This shouldn't be a problem either. In the worst case, the activity will be delivered to somebody else who will not be able to decrypt it. Replacingidandactormay be even a good thing (obfuscation).it was a giant mess of w3c specs.
It's an ever-expanding mess of W3C specs, RFCs and FEPs.
Integrity proofs are relatively new, they are described in Data Integrity W3C spec: https://www.w3.org/TR/vc-data-integrity/
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi
Citiverse è un progetto che si basa su NodeBB ed è federato! | Categorie federate | Chat | 📱 Installa web app o APK | 🧡 Donazioni | Privacy Policy