Skip to content
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

Add JSON Web Key to specification #135

Merged
merged 18 commits into from
Aug 12, 2023
Merged

Add JSON Web Key to specification #135

merged 18 commits into from
Aug 12, 2023

Conversation

msporny
Copy link
Member

@msporny msporny commented Jul 29, 2023

This PR addresses issue #130 and issue #73 by adding the JsonWebKey type to the specification and the vocabulary, and ensuring that the range of publicKeyJwk is JSON. This value was going to be defined in the JsonWebSignature2020 specification, but since that specification has been pulled, we have to define it somewhere else and the Data Integrity specification is probably the best place for it since it also defined controller documents and verification methods.


Preview | Diff

Copy link
Member

@iherman iherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an editorial comment, possibly with an editorial note. It may be worth emphasizing that the publicKeyJwk having a JSON datatype means that all json terms within the target are not subject to the JSON-LD context processing. Ie, the terms like kid or alg are not mapped to any URL.

vocab/security/vocabulary.yml Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
vocab/security/vocabulary.yml Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated

<p>
The example above is identical to the previous example, except that the
information is stored in the `secretKeyJwk` property and its value encodes the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm... privateKeyJwk vs secretKeyJwk... Is the intention to make this work with MAC Signatures? and thats why you choose secretKeyJwk ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that privateKeyJwk is a better name than secretKeyJwk.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intention to make this work with MAC Signatures? and thats why you choose secretKeyJwk ?

Yes, that's one of the reasons.

The other reason is due to the English definition of the word "private" vs. the English definition of the word "secret":

private: intended for or restricted to the use of a particular person, group, or class
secret: kept from knowledge or view; something kept hidden or unexplained

IOW, the word "secret", that is -- "do not share this with others", is closer to the intended usage of the property than "private", which can be misinterpreted as "its ok to share this information with a group" (which is almost never the case with a symmetric or a private key).

index.html Outdated
<p>
The example above is identical to the previous example, except that the
information is stored in the `secretKeyJwk` property and its value encodes the
private key value in the `d` property.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems possibly not true for all secret keys.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is definitely not true for all secret keys, and may yet be changing - why would we define any of this here rather than just point at rfc7517?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems possibly not true for all secret keys.

The language you are pointing to is providing a description of a specific example. It is not claiming that the example is true for all secret keys.

this is definitely not true for all secret keys, and may yet be changing - why would we define any of this here rather than just point at rfc7517?

Please re-read the /description of the example/. We are not defining anything here, merely explaining what an example is expressing.

Copy link
Contributor

@OR13 OR13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should get more reviews on the secretKeyJwk part... will it be in the vocabulary? can it be used with HMAC?.

Concrete change request is to define secretKeyJwk in the vocabulary or remove the example.

I'm not attached to privateKeyJwk vs secretKeyJwk... perhapse it would be good to ask the experts on the JOSE and COSE mailing lists how they feel about this?

@mprorock
Copy link
Contributor

+1 @OR13 - definitely want feedback in from the jose and cose lists

Copy link
Contributor

@mprorock mprorock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets get feedback requests out to appropriate experts - clean up some naming / guidance or just point to appropriate RFCs, otherwise i think this good

Copy link
Member

@TallTed TallTed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly small editorial stuff. One larger thing which I think is also editorial and hopefully not controversial.

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
@OR13
Copy link
Contributor

OR13 commented Aug 8, 2023

I agree with @iherman that secretKeyJwk or privateKeyJwk needs to be defined for this to be merged... and the same applies to publicKeyMultibase or secretKeyMultibase or privateKeyMultibase.

See also https://github.com/w3c/vc-data-integrity/pull/150/files#diff-af0ab1b57396186235708fdf500251dfc3f9b18aeeb992f927979d9630889c28R21

and https://github.com/w3c/vc-data-integrity/pull/149/files#diff-be8086ba9b3e09e91dd045c04051b6e1d0d2a10105db9d380835cb1151fd5470R29

Seems blocked pending #152 (review)

Copy link
Contributor

@OR13 OR13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending merge / approval of #152 (review)

@msporny msporny requested a review from iherman August 10, 2023 00:56
Copy link
Member

@iherman iherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made some inline comments.

I must say I am lost among all the PRs that refer to various property names, anchors, ranges, etc. I am of the opinion at this point that all these PRs should be merged asap to allow for a comprehensive review of the vocabulary, domains, ranges, etc, possibly leading to new PRs. The current situation is simply too chaotic in my view.

Comment on lines +1107 to +1163
"@context": ["https://www.w3.org/ns/security/jwk/v1"],
"id": "did:example:123456789abcdefghi#key-1",
"type": "JsonWebKey",
"controller": "did:example:123456789abcdefghi",
"publicKeyJwk": {
"kty": "OKP",
"alg": "EdDSA"
"crv": "Ed25519",
"kid": "key-1",
"x": "_1EiHquO2aUx9JARSu0P8jdYT_OVneYxYOnOMAmUcFI",
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need yet another context here? The definition of publicKeyJwk stipulates that its object is of datatype JSON, meaning that the properties within that object are ignored by any JSON-LD processing. If so, then I do not see any reason using a different context (which I have not seen defined anywhere).

Proposal: just use the usual security context here.

Copy link
Contributor

@OR13 OR13 Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need another context here.

I will object if one is required... however, I think its fine to ship many smaller contexts from w3id.org (which is not the W3C)... IMO W3C examples should use W3C context URLs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, seems we are following a different style here than the core context, where we seem to prefer bundling, that inconsistency, feels... not good to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OR13,

The @vocab in the core v2 context is what is driving the need to bundle. Whenever that isn't used, bundling should be avoided (unless there's some other very good reason to do it). That's the consistent rule we're applying.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raised #164 to track @OR13's concern, which seems to be more of a misunderstanding than a misalignment.

Comment on lines +1146 to +1202
"@context": ["https://www.w3.org/ns/security/jwk/v1"],
"id": "did:example:123456789abcdefghi#key-1",
"type": "JsonWebKey",
"controller": "did:example:123456789abcdefghi",
"secretKeyJwk": {
"kty": "OKP",
"alg": "EdDSA"
"crv": "Ed25519",
"kid": "key-1",
"d": "Q6JwjCUdThSnoxfXHSFt5C1nVFycY_ZpW7qVzK644_g",
"x": "_1EiHquO2aUx9JARSu0P8jdYT_OVneYxYOnOMAmUcFI",
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above. Except that we use here secretKeyJwk, but I presume the range of that property is also JSON

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same response as above, yes, range is JSON.

@msporny
Copy link
Member Author

msporny commented Aug 12, 2023

PR #152 has been merged into this PR. It has been two weeks since we asked for feedback from the COSE mailing list (and no feedback has been given). If we get feedback in the future, we can always raise an issue and modify this via a future PR. In the meantime, this PR needs to go in so we have the appropriate anchors to finish up the vocabulary and JSON Web Key sections of the specification.

@msporny msporny force-pushed the msporny-json-web-key branch from cf9f708 to 1852514 Compare August 12, 2023 19:26
@msporny
Copy link
Member Author

msporny commented Aug 12, 2023

Normative, multiple reviews, changes requested and made, no objections, merging.

@msporny msporny merged commit 8d5a7cf into main Aug 12, 2023
@msporny msporny deleted the msporny-json-web-key branch August 12, 2023 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.