decentralized-identity / didcomm-messaging

https://identity.foundation/didcomm-messaging/spec/
Apache License 2.0
167 stars 57 forks source link

Multiple keys of different types and Keys negotiation #238

Open ashcherbakov opened 3 years ago

ashcherbakov commented 3 years ago

Use Case

Consider the following situation:

Now Alice wants to encrypt a message for Bob (and possibly Carol).

DID Comm spec says (or at least must say, there is an issue there: #218: Need info about multiple recipients) that Alice must do encryption for every recipient key. As the key types must be equal (same curves), Alice should probably do encryption for every recipient key of the same type as her key.

Potential issues and unresolved questions

DID Comm spec doesn't discuss or specify the use case above. It's not 100% clear how Alice should choose the keys in case of multiple keys of different types. One of the simple proposals here is the following:

This case is closely related to #218 and #224 as it's related to Multiple recipients case and backward compatibility discussions (both are not defined in the DID Comm spec explicitly now).

TelegramSam commented 3 years ago

Fantastic Question. I'll raise this in the DIDComm WG on Monday.

kdenhartog commented 3 years ago

Yeah agree with @TelegramSam this is a great question. My initial take is that we should probably make this an implementation detail rather than a normative requirement (if it is one). This brings up an interesting question for me. Imagine I knew the sender's implementation encrypts for all messages, then I could choose to have the messenger encrypt the message for all 1000 keys this effectively becomes a DoS attack of sorts. I think we'll want to consider that impact.

AnomalRoil commented 3 years ago

Notice that a lot of the conversation in #218 is actually concerned about this very topic here.

TelegramSam commented 2 years ago

Discussed in WG 20211213. The DIDComm spec will only manage messages between two parties. Multi-party coordination is a concern for a higher level construct.

AnomalRoil commented 2 years ago

@TelegramSam this isn't about the number of party, two parties can each have multiple devices with different keys...

In general nothing prevents one DID to have multiple keys in it, 1 DID = 1 party, no? Notice the current spec says:

Unless previously coordinated in a layer above DIDComm, the default recipients of the envelope MUST include all the KeyAgreement entries, representing Bob.

And also:

All keys declared in the DID Document’s keyAgreement section should be used as recipients when encrypting a message.

So this question about how to handle different key types for the same DID remains open. Notice that ECDH-1PU is compatible with the notion of encrypting for different key types at once using the key wrapping, but it's currently underspecified in the ECDH-1PU spec: https://github.com/NeilMadden/jose-ecdh-1pu/issues/4