-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inconsistent mental model connecting id, kid, and references inside a DID doc #131
Comments
Indeed the |
I agree with @dhh1128 that this discussion is required. Especially, now that the JWK encoding became one of our champions in the DID spec, we should normalize how to use
In this context, we should also take into consideration that the DID resolution results are sometimes cached anyways. I saw some implementations that don't resolve a DID to a DID Document each time they use a DID. Furthermore, it would be great if we can get more clarity on how to use a @peacekeeper what would be a viable and deterministic way to point a DID URL to a version of the verification method or public key in a DID Document? |
An However, I expect that there are use cases where people want to be able to change out the key whilst keeping the |
Personally I think it would be nice if the Fragments in DID URLs are currently used to reference a specific part of the DID document with a certain The original proposal to make I agree with @dhh1128 that there is a semantic mismatch between If certain applications (DIDComm, OIDC, etc.) require immutable
Would this solve the problem? Applications and DID methods that want to use JWK and |
In general, I've found that this problem turns out to have a wicked amount of impact in a way that I'm still trying to wrap my head around. It seems every time that I try to use a key or a key reference this inconsistency causes a snag. Additionally, it seems any time I want to use a key I have to perform a dereference to make sure the crypto material actually is in a valid and trusted did document. So while I don't quite have any details to offer as a solution yet, I'm actively thinking about the problem and plan to watch this thread for insights. Also, what are some of the use cases where having mutable references to keys is advantageous? Everyone I can come up with in my head leads to one of two outcomes. Either it introduces a security vulnerability or the cryptographic operation the key is used for fails. I'm sure I'm just not thinking of the use cases where this could be beneficial so can someone help me out here? It would be good to have these use cases listed in this thread (and probably should be provided in the use case document too). |
It probably makes sense to stick with the semantics of To make a proposal, one use case that I can think of which is directly impacted of what we are discussing here is verifying a JWT/JWS by a verification method in the DID Document. Then, in order to do discover the specific verification method, you ideally want to use a DID URL, e.g., @selfissued @kdenhartog @dhh1128 @dlongley does that make sense? |
ActivityPub for example uses key URLs like Try this:
If the key rotates, I believe the key URL stays the same (although I admit that I haven't actually tried it). So my connected friends would find the new key without first having to figure out what the new URL is. I understand that this enables certain timing or caching attacks which are unacceptable for some use cases, but isn't the simplicitly of being able to always get the latest key under a well-known URL also an advantage?
Applications that want this could easily use certain kinds of DID URLs that are guaranteed to always dereference to the same content (see my previous message). |
Related: #134 My preference as follow:
You get the following:
With valid JWKs:
I'd rather never see Since we now support JWK encoding for all possible key types, it makes even more sense to provide strict guidance around I think its bad form to inject prefixing into the JWK format, slightly more acceptable to inject prefixed keys into JWE/JWA headers. Example VC Proof using JWT Proof Mechanism I think it would be better to have the header look like:
where |
Note that in Linked Data Proofs which use detached JWS, this is not an issue, since the verificationMethod is stored in the proof, not the JWS header (much cleaner IMO). Here is any example detached JWS Scroll down here for the credential associate with the example above: here |
@OR13 can you explain the rationale behind why we would need |
if you leave however, |
I'd rather Then use some new identifier for noting that a JWS/JWE can be verified with a publicKeyJwk from a did document... In other words, either: A.) B.) B seems more correct to me... when verifying a JWS if you thought of
To JWS.verify, which should fail, wheras passing:
would succeed... the value for @dlongley I know you have thought about this a lot, can you share your thoughts again?... more so on how to relate a DID to a vanilla JWS, how should the DID be expressed in the header? |
Ok I understand that would ensure we maintain greater consistency with how JOSE is used today. However I'd ask the following questions
Also I'd point out that there is a big difference in the purpose of the With a JWS the With a JWE the |
https://tools.ietf.org/html/rfc7638
https://tools.ietf.org/html/rfc7517#page-8
You can make this value whatever you want, but doing anything other than using https://tools.ietf.org/html/rfc7638 is not a good idea IF you can avoid it IMO.
For did documents that use JWS, but don't express keys as JWK... This has been one of the most frustrating things I have worked on in the last year. Everyone does whatever they want. Its a mess. Its the reason we pushed so hard for being allowed to use JWK for all supported key formats. There is no good solution here IMO. You can inject whatever values you want into your JWS/JWE https://www.w3.org/TR/vc-data-model/
They pretty much created this problem with this language...
note that because I would expect This is not a problem for Linked Data Proofs that use JWS, which don't even use the This has lead me to generally prefer Linked Data Proofs that use Detached JWS, because they have none of these inconsistencies, they rely on canonicalization algorithms, and they support JWS and JWK... so all key types that a DID Document can use, and all signature suites which are part of standard JOSE. |
@OR13 That might be irrelevant but not every implementation uses JWK as their underlying format, hence calculating the JWK thumbprint is not possible in all cases, e.g., in case of base58 encoding. In DIF, we agreed on the convention that The W3C VC spec does not mandate Updated: We could however update the W3C VC Implementation Guide to recommend how key discovery can be used in case DIDs are used, i.e., define either a convention for One of the reasons why we didn't include that in the VC spec is that it can be used also without DIDs and protocols might define their own discovery or don't require dynamic discovery at all. Updated: Just recognized that for the above question this is the wrong GitHub and WG :) . So, let's have the discussion in the VC WG when we return to maintenance. Though, this is great input and if we can establish a convention for |
I think the cleanest would be to introduce an IANA JWT claim for the header value called You have correctly pointed out that documentation is poor, I've got a number of open issue trying to fix this, but here is the definition you are looking for: https://w3c-dvcg.github.io/ld-proofs/#verification-method |
I don't have a strong opinion on whether use However, I would strongly argue for having the different proof purposes, e.g., |
In regards to the original scope of the issue raised by @dhh1128, I'd like to point out, even if we make the key id portion of a DID key reference immutably linked to a specific public key, such that the same id within the same did document cannot be used for another public key in future, this does not make the key id entirely immutable. DID documents are a mutable resource where a keys membership in the did document itself can change over time, if we made key ids immutably linked to a specific public key, you can reliable cache this relationship, but if you are verifying the keys usage in relation to the DID subject (such as whether the key is authorised to make assertions), you must still resolve the DID to test this. To be clear I'm not advocating that there is no merit to immutable key ids in did documents, I just saw worth in pointing out this nuance. |
Sorry for coming in so late to this discussion, but I just wanted to describe the mechanism that we are currently using to pass the public key of a signed JWT to the verifier of the JWT. Basically we encode the public key using RFC 7517, and transmit it as follows:
for ES256 the public key contains "a" and "b" and the "alg". For RS256 this contains "n" and "e" and the "alg". An example below for ES256 is
|
We need both |
|
This was addressed by #221, we have consensus, closing. |
Elsewhere (can't find location at the moment but would be glad if others pasted a link...) I saw a discussion about how
id
should not be required on keys, if those keys are expressed in JWK format, since JWKs have akid
field. The issue generated lots of discussion, and I'm not sure how it resolved.Implicit in that discussion is the assumption that a JWK's
kid
and a key'sid
in classic DID doc specs are intended to perform the same function, and that they have compatible semantics. However, it is clear to me that we are not sufficiently aligned as a community around these assertions, as evidenced by the following:kid
is a hint used for caching, much like theetag
header in HTTP. You are supposed to be able to look at thekid
and say, "Oh, I've already dereferenced that key. No need to dereference again." (@selfissued , please correct me if I'm mischaracterizing the tribal knowledge aboutkid
in JW* circles...) But currently, theid
on a key in a DID doc has explicitly incompatible semantics with this usage, because the value referenced bydid:example:abc123#xyz
is allowed to be different every time it is dereferenced!This disconnect is not causing the heartburn that it should. People are proposing to use DID URLs that contain a
kid
as a pointer to a specific key value, even though the DID URL doesn't contain a timestamp or version stamp and is therefore ambiguous. Validating signatures and doing other cryptographic operations with ambiguous inputs is the opposite of what DIDs are supposed to deliver, IMO.did:example:abc123#xyz
as references to a key withkid
= xyz -- as ifkid
could play the same role thatid
plays in fragments. Yet I know of no verbiage in any version of the DID spec that would support this. AFAIK, the only way to refer to a key bykid
would be something using matrix parameters, like maybedid:example:abc123;kid=xyz
-- and I'm not even sure that works. @peacekeeper, what does the guru say? So are we playing games with@context
that mapkid
into the role thatid
plays in more traditional JSON-LD--and if so, where is this documented, and why did we think this was a good idea?I think something has to give.
kid
andid
can't exist in free variation with semantics that overlap in some cases but not others.The text was updated successfully, but these errors were encountered: