Expand description
Selective Disclosure CBOR Web Token helpers.
This crate implements the SD-CWT disclosure and redaction mechanics from
draft-ietf-spice-sd-cwt-08 on top of cose2. It deliberately reuses
cose2 for COSE signing, verification and header storage; the APIs here
cover SD-CWT-specific header parameters, salted disclosures, redacted claim
markers, AEAD-encrypted disclosure wire structures, and restoration of a
presented claims set.
Structs§
- Aead
Encrypted Disclosure - One
sd_aead_encrypted_claimsentry. - Disclosure
- One Salted Disclosed Claim plus the exact bstr-encoded bytes used for hashing.
- Disclosure
Set - A collection of Salted Disclosed Claims.
- Issue
Result - Result of converting a pre-issued claims value into an issued SD-CWT value.
- Restore
Report - Result of restoring disclosed SD-CWT claims.
- Sha256
Redaction Hasher - SHA-256 redaction hasher, the SD-CWT default when
sd_algis omitted.
Enums§
- Aead
KeyContext - AEAD encrypted disclosure key context.
- Disclosure
Kind - A decoded Salted Disclosed Claim entry.
- Restore
Mode - Controls how unmatched Redacted Claim Hashes are handled during restoration.
Constants§
- ALG_
SHA_ 256 - The COSE algorithm identifier for SHA-256.
- CONTENT_
FORMAT_ KB_ CWT - CoAP content-format number for
application/kb+cwt. - CONTENT_
FORMAT_ SD_ CWT - CoAP content-format number for
application/sd-cwt. - CWT_
CLAIM_ CNONCE - SD-CWT
cnonceCWT claim key. - CWT_
CLAIM_ VCT - SD-CWT
vctCWT claim key. - HEADER_
CWT_ CLAIMS - COSE header parameter
CWT_Claims. - HEADER_
KCWT - COSE header parameter
kcwtused by Key Binding Tokens. - HEADER_
SD_ AEAD - COSE header parameter
sd_aead. - HEADER_
SD_ AEAD_ ENCRYPTED_ CLAIMS - COSE header parameter
sd_aead_encrypted_claims. - HEADER_
SD_ ALG - COSE header parameter
sd_alg. - HEADER_
SD_ CLAIMS - COSE header parameter
sd_claims. - HEADER_
TYP - COSE header parameter
typ. - REDACTED_
CLAIM_ KEYS_ SIMPLE - The CBOR simple value used as the
redacted_claim_keysmap key. - REDACTED_
ELEMENT_ TAG - The CBOR tag used for redacted array elements.
- TO_
BE_ DECOY_ TAG - The CBOR tag used in pre-issuance maps to request decoys.
- TO_
BE_ REDACTED_ TAG - The CBOR tag used in pre-issuance maps to mark a key or element for redaction.
Traits§
- Redaction
Hasher - Redaction hash algorithm used for Salted Disclosed Claims.
- Salt
Generator - Source of 128-bit salts for issuance helpers.
Functions§
- aead_
encrypted_ disclosures_ from_ unprotected - Reads
sd_aead_encrypted_claimsfrom an unprotected header. - default_
hasher_ for_ sd_ alg - Returns the built-in SHA-256 hasher for
sd_alg = -16or an omittedsd_alg. - disclosures_
from_ unprotected - Reads
sd_claimsfrom an unprotected header. - is_
redacted_ claim_ keys_ label - Returns true when
valueis the SD-CWTredacted_claim_keysmap label. - issue_
from_ preissuance - Converts a pre-issued claims value containing tag 58/62 requests into an issued value.
- redacted_
claim_ keys_ label - Returns the SD-CWT
redacted_claim_keysmap label,simple(59). - redacted_
element - Wraps a redacted array-element hash as CBOR tag 60.
- restore
- Restores a claims value using the selected validation mode.
- restore_
for_ holder - Restores a claims value using Holder validation rules.
- restore_
for_ verifier - Restores a claims value using Verifier validation rules.
- restore_
payload_ from_ message - Decodes a COSE payload as CBOR and restores it using disclosures in the message header.
- restore_
payload_ with_ disclosures - Decodes a COSE payload as CBOR and restores it with caller-supplied disclosures.
- sd_aead
- Reads the
sd_aeadprotected header parameter. - sd_alg
- Reads the
sd_algprotected header parameter. - set_
aead_ encrypted_ disclosures - Writes
sd_aead_encrypted_claimsto an unprotected header. - set_
disclosures - Writes
sd_claimsto an unprotected header, omitting the parameter when empty. - set_
kb_ cwt_ typ - Sets the Key Binding Token content type (
typ) header toapplication/kb+cwt(294). - set_
sd_ aead - Sets the
sd_aeadprotected header parameter. - set_
sd_ alg - Sets the
sd_algprotected header parameter. - set_
sd_ cwt_ typ - Sets the SD-CWT content type (
typ) header toapplication/sd-cwt(293).