Selective disclosure with SD-JWT
Northwind needs Riley's course and result but not their email address, and a signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message. covers exact bytes. This lesson shows how SD-JWT lets Cedar sign a credential from which Riley's walletAn application that holds a person's verifiable credentials and the keys that go with them, receives credentials from issuers, and presents them to verifiers when the person agrees. can reveal chosen claims, what leaving a claim out does and does not say, how a Key Binding JWT stops a copied presentation, and what still links presentations together.
Reveal a chosen claim without editing the signature
Riley's course credential from Cedar carries three claims: the course, their result, and their email address. Northwind's project prerequisite needs the first two. It has no use for their email, and Riley would rather not hand it to every organization that asks about their training.
The obvious fix does not work. If Riley's wallet deleted the email from a signed credential before sending it, the bytes would no longer match what Cedar signed, and Northwind's signature check would fail. As Digital signatures showed, a signature covers exact bytes. Cedar would need to sign something that commits to each claim without containing it, so that Riley can choose later which ones to open.
Selective Disclosure for JWTs (SD-JWT) does this with hashes. For each claim Riley may want to hide, Cedar builds a disclosure: a small JSONA text format for structured information, written as named values inside curly braces. APIs, tokens, and discovery documents all use it. array holding a random value called a salt, the claim name, and the claim value, encoded as base64urlA way of encoding data as ordinary text characters so it can travel safely in headers, URLs, and JSON. Anyone can decode it, so it hides nothing; Base64url is a variant safe for URLs, used in JWTs.. Cedar then hashes the encoded disclosure with SHA-256 and puts only that digest in the credential it signs. Here is the course claim at each step. The values are fictional but computed for real, so the digest can be checked with the commands from Encoding and hashing.
Disclosure, decoded
["2GLC42sKQveCfGfryNRN9w", "course", "cedar-basic"]
Disclosure, as sent (base64url of the JSON text above)
WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwgImNvdXJzZSIsICJjZWRhci1iYXNpYyJd
Digest (base64url of SHA-256 over the ASCII characters of the disclosure as sent)
HO15b7DCnJyXa9P9oifSZALazMOWc32Xy9EvfhhYfrsThe other two claims get disclosures of their own, each with a fresh salt. Cedar collects the three digests into an _sd array, names the hashTurning data into a short, fixed-size value called a hash, in a way that cannot be reversed and where changing one character changes the result completely. Services store password hashes instead of passwords, and signatures are made over a hash. algorithm in _sd_alg, and signs the result as an ordinary JWT, the issuer-signed part of the credential. Its vct claim names the credential type, and cnf carries the public keyThe half of a key pair that can be shared freely. It checks signatures made with the matching private key and can encrypt data that only that private key can decrypt. of Riley's wallet, which matters later in this lesson.
Header
{
"alg": "ES256",
"typ": "dc+sd-jwt",
"kid": "cedar-vc-2026"
}
Payload
{
"iss": "https://credentials.cedar.example",
"vct": "https://credentials.cedar.example/course-completion",
"iat": 1790949600,
"exp": 1854108000,
"_sd": [
"HO15b7DCnJyXa9P9oifSZALazMOWc32Xy9EvfhhYfrs",
"S8hPwrZZfOnCH-WUVng4EFbsZtM0201EgX5TNps1InY",
"nOTrYNS9nfFIx79U5zkdk-epAf3IIMl2EwpFYrFubdc"
],
"_sd_alg": "sha-256",
"cnf": {
"jwk": {
"kty": "EC",
"crv": "P-256",
"x": "HUHZ44gDzvw4dKiztjfbdX4GkPgE6eKHu3r3f1wgfa4",
"y": "aA19bcDxYdJl4ALGshINuCEjHSA-O_Z9UQOI6uhDhRU"
}
}
}| Claim | Disclosure, decoded | Digest in _sd |
|---|---|---|
| course | ["2GLC42sKQveCfGfryNRN9w", "course", "cedar-basic"] | HO15b7DCnJyXa9P9oifSZALazMOWc32Xy9EvfhhYfrs |
| result | ["iVGjNB1Y1MKQ_QDeJIWwnQ", "result", "passed"] | S8hPwrZZfOnCH-WUVng4EFbsZtM0201EgX5TNps1InY |
["FT65bMhvvRrZi6cfjB9MXA", "email", "[email protected]"] | nOTrYNS9nfFIx79U5zkdk-epAf3IIMl2EwpFYrFubdc |
The salt is what keeps a hidden claim hidden. Without it, Northwind could hash the guess ["result", "failed"], compare it with the digests, and learn Riley's result without being shown it. A random salt that only the wallet knows makes that guessing useless.
Cedar hands Riley's wallet the signed JWT together with all three disclosures. When they present to Northwind, the wallet sends the signed JWT followed by only the disclosures they choose, separated by tildes: <issuer-signed JWT>~<course disclosure>~<result disclosure>~. Northwind first verifies Cedar's signature over the JWT. Then, for each disclosure, it repeats Cedar's step: hash the characters it received, and look for the result in the signed _sd array. A match means the claim is one Cedar signed, and Northwind adds it to the claims it will use.
Suppose someone edits the course disclosure to claim the advanced course, keeping the same salt:
Presented: WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwgImNvdXJzZSIsICJjZWRhci1hZHZhbmNlZCJd
Decodes to: ["2GLC42sKQveCfGfryNRN9w", "course", "cedar-advanced"]
Recomputed: U5bZ3Fh3oNXGb8jVK0QjyYqpyT-gzeLVZhvyfkGzPxk
In _sd? no -> reject the presentationChanging one word produced a completely different digest, and nothing in the signed array matches it. Producing a disclosure that hashes to one of Cedar's digests would mean breaking SHA-256, and adding a new digest would break Cedar's signature. A disclosure that matches nothing is not quietly ignored: the whole presentation is rejected.
Omission is not a new assertion
Riley sends the course and result disclosures and keeps the email back. Northwind still sees all three digests in the signed JWT, including one it cannot open. It is tempting to read the unopened digest as proof that one real claim was held back, but even that much is not guaranteed. SD-JWT lets an issuerThe party that creates and signs a token, assertion, or certificate, named in a token's iss claim. A recipient must check that the issuer is exactly the one it expected and trusts. add decoy digests: entries in _sd that match no disclosure at all, put there precisely so a verifier cannot count how many real claims exist or tell that anything was withheld. So an unopened digest means only that something might have been held back, and Northwind learns nothing about what. The same mechanism can hide array elements, not just whole claims, by placing a digest in the array in place of the value.
| Claim | In this presentation | What Northwind may conclude |
|---|---|---|
| course | Disclosed, digest matches | Cedar signed cedar-basic |
| result | Disclosed, digest matches | Cedar signed passed |
| Not disclosed | Nothing about the email: not that it is empty, missing, or any particular address |
Hiding a claim gives Riley no new powers over the ones they show. They cannot change their result, because any edited disclosure fails the digest check. They cannot assert that the hidden email is false or blank, because an absent disclosure asserts nothing. And if Northwind's policy required a claim they chose not to send, the presentation simply does not meet the policy. Northwind refuses it, or asks again, rather than filling the gap with a guess.
Northwind's checks have to be the real ones. Decoding the JWT and reading the disclosures is inspection, useful for understanding a credential and worth nothing as verification. The verifier checks Cedar's signature with a key from Cedar's published metadata, confirms that Cedar is an accepted issuer for this credential type and that the credential is within its validity period, and processes every disclosure against the digests. It also rejects the odd cases a careless parser might accept: a digest that appears more than once, or a disclosed claim whose name is already used by a claim visible in the signed payload. A changed disclosure must fail even when its JSON looks perfectly plausible.
Holder binding is an independent policy
Everything so far can be copied. If Riley's presentation were captured from a log, anyone could send the same string to Northwind, and every digest would still match. The cnf claim is what stops this. Cedar put the public key of Riley's wallet in the signed JWT, so the wallet can prove it holds the matching private keyThe half of a key pair that its owner keeps to themselves and uses to create signatures or decrypt data. Anyone who obtains it can act as its owner..
It does so with a Key Binding JWT (KB-JWT), a small JWT the wallet signs at presentation time and appends after the last tilde. Its payload says who the presentation is for and which exchange it answers:
Presentation (shortened, line breaks added; the real value is one string)
eyJhbGciOiJFUzI1NiIsInR5cCI6ImRjK3NkLWp3dCIsImtpZCI6ImNlZGFyLXZjLTIwMjYifQ.eyJpc3Mi...KH2A
~WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwgImNvdXJzZSIsICJjZWRhci1iYXNpYyJd
~WyJpVkdqTkIxWTFNS1FfUURlSklXd25RIiwgInJlc3VsdCIsICJwYXNzZWQiXQ
~eyJhbGciOiJFUzI1NiIsInR5cCI6ImtiK2p3dCJ9.eyJpYXQi...pAdDg
KB-JWT header
{
"alg": "ES256",
"typ": "kb+jwt"
}
KB-JWT payload
{
"iat": 1792145700,
"aud": "x509_san_dns:verifier.northwind.example",
"nonce": "Zf_4b7lKBqU3rsSa",
"sd_hash": "YzKgFDtlP1f7B_5DZ2AW5qBQJw81Yvx4JP9ry862Vpw"
}The aud names Northwind's verifier, by an identifier taken from the DNSThe Domain Name System, the internet's lookup service that turns a domain such as photos.example into the address of the computer serving it. Whoever controls a name's DNS records controls where that name points. name in its certificateA signed statement that a public key belongs to a name, such as a website's hostname, for stated purposes and a limited period. A certificate authority signs it, so software that trusts the authority can connect the key to the name., and nonce is the random value Northwind generated for this request. The iat says when the wallet signed it, so Northwind can refuse proofs that are too old. The sd_hash is a SHA-256 digest, again in base64url, of everything before the KB-JWT: the issuer-signed JWT, the two chosen disclosures, and their tildes. That ties the proof to exactly this selection, so it cannot be cut off and attached to a different set of disclosures. Northwind checks the KB-JWT's signature against the key in cnf, recomputes sd_hash, and compares aud and nonce with the request it actually sent.
Whether the KB-JWT is required is Northwind's decision, made from its policy before the presentation arrives. Some uses do not need it. Northwind's project prerequisite does, because a course result anyone could replay would prove nothing about the person asking. That is why one tempting shortcut is a real fault: checking the KB-JWT carefully when it is present, and skipping the check when it is absent. A presentation without a KB-JWT simply ends at the last tilde, and anyone who copied Riley's presentation could strip the KB-JWT off and send what remains. With binding required, a missing KB-JWT is a refusal, not a quieter path through the verifier.
Minimize more than the visible fields
Hiding the email does not make Riley anonymous to Northwind, and it does not stop presentations being linked. Every presentation of this credential carries the same issuer signature, the same cnf key, and the same _sd digests. If Northwind and another organization compared what they received, those values would match exactly and show that the same credential, and so the same person, visited both. The disclosed values can identify them too, and so can when and from where their wallet connected. Some issuers reduce the signature and key overlap by giving the wallet several copies of a credential, each with its own salts and key, so each verifier can see a different one. Whether that happens depends on the issuer and wallet, not on the format alone.
Minimizing, then, starts with the request. Northwind asks for the course and the result because the prerequisite needs exactly those, and Riley's wallet can tell them plainly what is being asked and why. It continues in Northwind's own records. The verifier needs to remember that Riley's presentation met the prerequisite on 16 October and which check refused a failed one. It does not need the salts, the disclosures, or the raw presentation in its routine logs, where they would be one more copy of Riley's data to protect.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Verify a real SD-JWT presentation and its key bindingCheck a supplied SD-JWT VC and its KB-JWT on your own computer: the issuer signature, each disclosure digest including decoys, the sd_hash, aud and nonce, then see a changed disclosure and a stripped binding refused.