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

Improve CDDL and fix examples #9

Merged
merged 10 commits into from
Jul 17, 2024
Merged

Conversation

rohanmahy
Copy link
Contributor

First commit fixes the example (missing commas, wrong keys).
Subsequent commits will make changes to CDDL.

@rohanmahy rohanmahy marked this pull request as ready for review July 5, 2024 08:17
? &(cnonce: 39) ^ => bstr,
;
; sd-cwt new claims
&(sd_hash: TBD3) ^ => bstr,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This belongs in the key binding token... we want the confirmation method to be bound to the exact claims (via hash) that the holder disclosed.

Copy link
Contributor Author

@rohanmahy rohanmahy Jul 9, 2024

Choose a reason for hiding this comment

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

both the sd_claims and the salted values are in an sd-cwt-issued (sent from Issuer to Holder). In order for the holder to validate the sd_claims completely, they need to be hashed and the Holder needs to know the hash function and the hash of the whole sd_claims array (which are in the unprotected).

I guess the sd-kbt needs sd-hash as well to be a hash of whichever sd_claims are disclosed in that particular parent sd-cwt-presentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe we need 2 parameters:
issued_claims_hash in the sd-cwt and presented_claims_hash in the sd-kbt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In order for the holder to validate the sd_claims completely, they need to be hashed and the Holder needs to know the hash function and the hash of the whole sd_claims array (which are in the unprotected).

I see why you are saying the issuer needs to include the sd_hash here... You want the holder to be assured they know all claims.

This can be accomplished by including the "all claims disclosed hash" in the issuer payload, un redacted... and then they holder acts as a verifier for the included disclosures from the issuer, and confirms they are correct before attempting redaction.

The holder can also process the issuer payload, and if they encounter any redactions which are not satisfied by the issuer disclosed claims, they can error.

The latter is how I have been solving this problem to date.

@rohanmahy
Copy link
Contributor Author

rohanmahy commented Jul 10, 2024 via email

@OR13
Copy link
Collaborator

OR13 commented Jul 11, 2024

The issuer signs all redacted claims in the payload, and the disclosed salted claims for each in the unprotected header.

There are a few cases, but let's look at a complex one as an example:

3 nested redacted claims.

The holder gets the credential from the issuer, and they are only able to disclose the first 2 layers... They know the issuer left off the last disclosure.

If the holder can disclose all 3, and there are no remaining disclosures, the holder has all the disclosures and knows where they go in the payload, and the issuer does not need to include a separate hash of all disclosures in the payload.

When the holder presents to a verifier, the key binding token needs to be associated to a specific set of disclosure.

The holder filters the disclosures array, encodes the full array as a bstr, hashes the bstr and uses their confirmation key to sign the kbt.

The verifier, checks the issuer signature.
Checks the key binding token signature.
Checks the kbt claims digest and ensures that it matches the digest of disclosed claims in the unprotected header.

And then the verifier processes each disclosed claim updating the payload until there are no more redactions to substitute.

At this point, if there are unprocessed disclosures that's an error.

If there are redactions for which there is no disclosure they are omitted.

Assume the issuer signed a hash of all disclosures.

The holder doesn't need this information, because they can confirm if the issuer has not revealed all disclosures without it.

A verifier cannot use it, because a common case for the verifier is that they receive a subset of disclosed claims.

This is why the hash of disclosed claims is in the kbt which is signed by the holder, instead of the issuer signed token.

This process is the same in sd-jwt, and possibly explained better than me in a GitHub comment written from my phone :)

rohanmahy and others added 3 commits July 17, 2024 11:48
Co-authored-by: Orie Steele <orie@or13.io>
Co-authored-by: Orie Steele <orie@or13.io>
Co-authored-by: Orie Steele <orie@or13.io>
],
/ swversion / 271 : [
"3.5.5",
{ "...": h'45dd87af' /redacted version element/ }
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is the JWT version not the CWT version of this

* key => any
}

;redacted_element = { "...": bstr }
Copy link
Collaborator

Choose a reason for hiding this comment

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

technically this should be some "tag": bstr

@OR13 OR13 merged commit c5f18e6 into mesur-io:main Jul 17, 2024
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.

3 participants