Proof suites
Each proof format is one suite behind the same key/verify primitives.
VC-JWT
openvc.proof.vc_jwt
openvc.proof.vc_jwt — VC-JWT proof suite (ES256 / EdDSA).
Responsibilities
- peek_issuer : read
iss+kidfrom a token WITHOUT verifying — so the caller knows which DID/key to resolve. The result is UNTRUSTED. - verify : verify the JWS signature against a resolved public JWK, validate
temporal claims, and reconcile the JWT envelope with the embedded
vcobject per the W3C VC-JWT rules. Returns the credential. - sign : assemble a compact JWS by delegating the raw signature to a SigningKey backend (which may be backed by an HSM / Vault), so a private key never has to live in this process.
Security posture
- Algorithm allow-list is fixed (ES256, ES384, EdDSA, and the RFC 9864
fully-specified name Ed25519, which is EdDSA over Ed25519).
alg: none, RS, HS are rejected before any crypto runs — this is the primary defence against alg-confusion. (ES384 is the P-384 leg of the Data Integrity ecdsa-*-2019 suites; it does not change the EBSI/EUDI-preferred ES256 path. IANA deprecated the polymorphic "EdDSA" in RFC 9864, so "Ed25519" is accepted alongside it — see the versioning guide for the migration.) - The verification algorithm is taken from the token header ONLY after checking it against the allow-list, and is then pinned when calling the verifier.
- peek_issuer never influences verification; it exists solely to select a key.
ClaimsInvalid
Bases: ProofError
A required claim is missing, malformed, or does not satisfy policy.
Source code in src/openvc/proof/errors.py
47 48 | |
MalformedToken
Bases: ProofError
A compact JWS / SD-JWT string is not well-formed.
Source code in src/openvc/proof/errors.py
43 44 | |
ProofError
Bases: OpenvcError
Base class for every proof-suite failure (signature, format, temporal, policy).
Source code in src/openvc/proof/errors.py
23 24 | |
SignatureInvalid
Bases: ProofError
A proof/signature did not verify.
Source code in src/openvc/proof/errors.py
27 28 | |
UnsupportedAlgorithm
Bases: ProofError
The JOSE algorithm is not in the {ES256, ES384, EdDSA, Ed25519} allow-list.
Source code in src/openvc/proof/errors.py
39 40 | |
SigningKey
Bases: Protocol
A private-key handle. sign may call out to an HSM/Vault.
sign MUST return a JWS-compatible signature:
* ES256 -> raw R||S concatenation, 64 bytes (NOT DER)
* ES384 -> raw R||S concatenation, 96 bytes (NOT DER)
* EdDSA -> raw 64-byte Ed25519 signature
Source code in src/openvc/proof/vc_jwt.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
alg
property
The JOSE algorithm identifier — "ES256", "ES384", "EdDSA" or
the RFC 9864 fully-specified "Ed25519".
kid
property
The verification-method id this key signs as (e.g. did:…#key-1).
sign(signing_input)
Sign signing_input; return the raw JWS signature (R‖S / 64-byte, never DER).
Source code in src/openvc/proof/vc_jwt.py
91 92 | |
VcJwtProofSuite
VC-JWT (JOSE-secured Verifiable Credential) proof suite.
Source code in src/openvc/proof/vc_jwt.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | |
peek_issuer(token)
Return (iss, kid) WITHOUT verifying the signature.
UNTRUSTED. Use only to decide which DID to resolve and which key to fetch. Never make a trust decision on this output.
Source code in src/openvc/proof/vc_jwt.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
peek_claims(token)
Decode the full claim set WITHOUT verifying the signature. UNTRUSTED. Used to read TIR accreditation bodies before the trust-chain walk.
Source code in src/openvc/proof/vc_jwt.py
166 167 168 169 170 171 172 173 174 175 176 | |
verify(token, *, public_key_jwk, expected_types=None, audience=None)
Verify signature + temporal claims + VC-JWT reconciliation.
Source code in src/openvc/proof/vc_jwt.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | |
sign(credential, *, signing_key, expires_in_s=None)
Wrap a VCDM credential in a VC-JWT, signing via the key backend.
The raw signature is produced by signing_key.sign(...), so an HSM/Vault
backend keeps the private key out of this process entirely. The algorithm
is allow-listed by the shared compact-JWS assembler before signing.
Source code in src/openvc/proof/vc_jwt.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
SD-JWT VC
openvc.proof.sd_jwt
openvc.proof.sd_jwt — SD-JWT VC proof suite (selective disclosure).
Implements the IETF SD-JWT VC family
- RFC 9901 (the SD-JWT mechanism; formerly draft-ietf-oauth-selective-disclosure-jwt)
- draft-ietf-oauth-sd-jwt-vc (the VC profile:
vct,cnf,status…; a draft that builds on RFC 9901)
The third proof profile alongside VC-JWT (:mod:openvc.proof.vc_jwt) and Data
Integrity — and the format EUDI/ARF converges on. It reuses the same JOSE
machinery: the SigningKey backend (HSM-friendly, the private key never enters
the process) and the fixed {ES256, ES384, EdDSA, Ed25519} algorithm allow-list
checked before any crypto runs.
How SD-JWT works, briefly
Selectively-disclosable claims are removed from the issuer-signed JWT and each is
replaced by the digest of a disclosure — a salted [salt, name, value]
(object) or [salt, value] (array element) blob. The digests live under _sd
(objects) or as {"...": digest} (array elements). The combined presentation is
<issuer-signed-jwt>~<disclosure 1>~...~<disclosure N>~<optional KB-JWT>
The holder chooses which disclosures to send; the verifier hashes each received
disclosure, matches it against the digests, and reconstructs only the disclosed
claims. A Key Binding JWT (typ: kb+jwt), signed by the holder key named in
the issuer's cnf, binds a presentation to an audience + nonce and to the exact
set of disclosures (via sd_hash).
Revocation is out of band: an SD-JWT VC's status claim can carry an IETF Token
Status List reference — check it with :func:openvc.status.check_token_status
over the verified claims.
SdJwtError
Bases: ProofError
Malformed SD-JWT structure, disclosure, or key-binding.
Source code in src/openvc/proof/sd_jwt.py
69 70 | |
SdJwtVcProofSuite
SD-JWT VC issuance, holder presentation, and verification.
Source code in src/openvc/proof/sd_jwt.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
peek_issuer(sd_jwt)
Return (iss, kid) from the issuer-signed JWT WITHOUT verifying. UNTRUSTED — use only to select which key to resolve.
Source code in src/openvc/proof/sd_jwt.py
215 216 217 218 219 220 221 222 | |
issue(claims, *, signing_key, disclosable=(), holder_jwk=None, vct=None, expires_in_s=None, decoys=0, x5c=None)
Issue an SD-JWT VC: <issuer-jwt>~<disclosure>~...~.
disclosable names the top-level claims to make selectively
disclosable (each leaves the JWT for a disclosure + an _sd digest).
holder_jwk binds the credential to a holder key (cnf) for later
key binding. decoys adds that many decoy digests (privacy). The raw
signature is produced by signing_key — HSM/Vault friendly.
x5c places an X.509 certificate chain (base64 DER, leaf first) in the
issuer JWT header, so a verifier that anchors trust in a trusted list can
validate it in one call: verify_credential(sd_jwt, x5c_trust_anchors=[…])
chains the leaf to those anchors and binds it to iss (see :mod:openvc.x5c).
The leaf certificate's key MUST be the signing_key's public key, and iss
must appear in the leaf's Subject Alternative Name, or verification fails closed.
Source code in src/openvc/proof/sd_jwt.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | |
create_presentation(sd_jwt, *, holder_key, audience, nonce)
Holder side: attach a Key Binding JWT over the (all-disclosure)
presentation, bound to audience and nonce. Returns the full
<issuer-jwt>~<disclosures>~<KB-JWT>.
Source code in src/openvc/proof/sd_jwt.py
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
verify(presentation, *, public_key_jwk, audience=None, nonce=None, require_key_binding=False, expected_vct=None)
Verify an SD-JWT (VC) presentation end to end.
Verifies the issuer signature + temporal claims, validates and unpacks the
disclosures, and — if a KB-JWT is present (or required) — verifies it
against the holder key in cnf and checks aud / nonce /
sd_hash.
Source code in src/openvc/proof/sd_jwt.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
make_object_disclosure(salt, name, value)
Encode an object-property disclosure [salt, name, value].
Source code in src/openvc/proof/sd_jwt.py
89 90 91 | |
make_array_disclosure(salt, value)
Encode an array-element disclosure [salt, value].
Source code in src/openvc/proof/sd_jwt.py
94 95 96 | |
disclosure_digest(disclosure, *, hash_name=_DEFAULT_HASH)
The base64url digest of a disclosure string — hashed exactly as received (never re-serialized), which is why the verifier needs no canonicalization.
Source code in src/openvc/proof/sd_jwt.py
99 100 101 102 103 104 105 106 | |
Data Integrity — eddsa-rdfc-2022
openvc.proof.data_integrity
openvc.proof.data_integrity — Data Integrity proof suite, cryptosuite
eddsa-rdfc-2022 (W3C VC Data Integrity + EdDSA Cryptosuites).
The second proof profile alongside :mod:openvc.proof.vc_jwt. Where VC-JWT wraps
a credential in a JOSE token, a Data Integrity proof is embedded in the
credential's own JSON as a proof object, and integrity is computed over the
RDF canonical form (RDFC-1.0 / URDNA2015) rather than the raw bytes — so it
survives re-serialization.
Algorithm (vc-di-eddsa §3.3, eddsa-rdfc-2022):
- proofConfig = the proof object without
proofValue, carrying the document's@context; canonicalize to N-Quads, SHA-256 it. - the unsecured document (
proofremoved); canonicalize, SHA-256 it. - hashData = proofConfigHash ‖ documentHash (64 bytes).
- Ed25519-sign hashData;
proofValue = 'z' + base58btc(signature).
Signing goes through the :class:~openvc.proof.vc_jwt.SigningKey protocol (so an
HSM/Vault Ed25519 key drops in). Requires the optional pyld dependency (the
[data-integrity] extra) for canonicalization; importing this module without
it is fine, only sign/verify need it.
CredentialExpired
Bases: ProofError
The credential's validity window has ended (validUntil / expirationDate / proof expires).
Source code in src/openvc/proof/errors.py
53 54 | |
CredentialNotYetValid
Bases: ProofError
The credential's validity window has not started (validFrom / issuanceDate).
Source code in src/openvc/proof/errors.py
57 58 | |
KeyResolutionError
Bases: ProofError
The proof's verificationMethod key could not be resolved.
Source code in src/openvc/proof/errors.py
69 70 | |
MalformedTimestamp
Bases: ProofError
A validity timestamp is present but not a parseable date-time (fails closed).
Source code in src/openvc/proof/errors.py
61 62 | |
PresentationBindingError
Bases: ProofError
A presentation proof's challenge / domain does not match what the verifier expects.
Source code in src/openvc/proof/errors.py
73 74 | |
ProofPurposeMismatch
Bases: ProofError
The proof's proofPurpose is not the expected one (e.g. assertionMethod).
Source code in src/openvc/proof/errors.py
65 66 | |
ProofMalformed
Bases: ProofError
The proof object is structurally invalid — missing or wrongly typed fields.
Source code in src/openvc/proof/errors.py
31 32 | |
SignatureInvalid
Bases: ProofError
A proof/signature did not verify.
Source code in src/openvc/proof/errors.py
27 28 | |
UnsupportedCryptosuite
Bases: ProofError
The proof declares a cryptosuite this suite does not implement.
Source code in src/openvc/proof/errors.py
35 36 | |
DataIntegrityProofSuite
Sign and verify credentials with an embedded eddsa-rdfc-2022 proof.
Source code in src/openvc/proof/data_integrity.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
add_proof(credential, *, signing_key, verification_method, proof_purpose='assertionMethod', challenge=None, domain=None, created=None, extra_contexts=None)
Return a copy of credential secured with a Data Integrity proof.
verification_method is embedded verbatim (a did:key / did:web URL a
verifier can resolve). For a presentation proof (proof_purpose=
"authentication") pass challenge / domain to bind it to a verifier
session; both are covered by the signature. The input is not mutated.
Source code in src/openvc/proof/data_integrity.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
verify(secured, *, public_key_jwk=None, resolver=None, expected_proof_purpose='assertionMethod', expected_challenge=None, expected_domain=None, now=None, extra_contexts=None)
Verify the embedded proof end to end.
Key selection: with public_key_jwk the proof must verify against that
operator-trusted key; otherwise the key is resolved from the proof's
verificationMethod — via resolver (a DidResolver /
DidResolverRegistry, e.g. to reach did:web) when given, falling
back to offline did:key. A resolved key must be authorized by the DID
document for expected_proof_purpose.
Policy (checked after the signature verifies): the proof's
proofPurpose must equal expected_proof_purpose (pass None to
skip), and the credential's validity window
(validFrom/validUntil or issuanceDate/expirationDate) plus
the proof's expires must contain now (default: current time) within
the suite's leeway.
Source code in src/openvc/proof/data_integrity.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
Data Integrity — ecdsa-rdfc-2019 (P-256 / P-384)
openvc.proof.di_ecdsa_rdfc
openvc.proof.di_ecdsa_rdfc — the ECDSA RDF Data Integrity cryptosuite
ecdsa-rdfc-2019 (W3C VC Data Integrity ECDSA Cryptosuites v1.0).
The ECDSA analogue of :class:~openvc.proof.data_integrity.DataIntegrityProofSuite
(eddsa-rdfc-2022): same RDF N-Quads canonicalization (RDFC-1.0 / URDNA2015,
via pyld) and the same config-first hashData ::
hashData = H(canonicalize(proofConfig)) ‖ H(canonicalize(unsecuredDocument))
but it signs ECDSA instead of Ed25519 — P-256/SHA-256 (ES256) or
P-384/SHA-384 (ES384), raw R‖S like the JOSE path, the digest chosen by the
key's curve (vc-di-ecdsa §3.x). It is to eddsa-rdfc-2022 what
:class:~openvc.proof.di_jcs.EcdsaJcsProofSuite (ecdsa-jcs-2019) is to
eddsa-jcs-2022, only over RDF rather than JCS — so it reuses the RDF
canonicalization helpers from :mod:openvc.proof.data_integrity and the
multi-curve ECDSA key handling shape from :mod:openvc.proof.di_jcs.
Signing goes through the :class:~openvc.proof.vc_jwt.SigningKey protocol (so an
HSM/Vault P-256/P-384 key drops in). Like the RDF eddsa-rdfc-2022 path — and
unlike the JCS suites — it needs the optional pyld dependency (the
[data-integrity] extra) for canonicalization; importing this module without it
is fine, only sign/verify need it.
EcdsaRdfcProofSuite
Sign and verify credentials with an embedded ecdsa-rdfc-2019 proof.
Whole-document (non-selective) ECDSA Data Integrity over RDF N-Quads —
P-256/SHA-256 (ES256) or P-384/SHA-384 (ES384), selected by the
signing/verification key's curve. The RDF sibling of
:class:~openvc.proof.di_jcs.EcdsaJcsProofSuite; needs pyld (the
[data-integrity] extra), which the JCS suite does not.
Source code in src/openvc/proof/di_ecdsa_rdfc.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
add_proof(credential, *, signing_key, verification_method, proof_purpose='assertionMethod', challenge=None, domain=None, created=None, extra_contexts=None)
Return a copy of credential secured with an ecdsa-rdfc-2019 proof.
verification_method is embedded verbatim (a did:key / did:web URL a verifier
can resolve). For a presentation proof (proof_purpose="authentication") pass
challenge / domain to bind it to a verifier session; both are covered by the
signature. The input is not mutated. Like the eddsa-rdfc-2022 suite this
canonicalizes over RDF, so any non-bundled @context term must be supplied via
extra_contexts.
Source code in src/openvc/proof/di_ecdsa_rdfc.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
verify(secured, *, public_key_jwk=None, resolver=None, expected_proof_purpose='assertionMethod', expected_challenge=None, expected_domain=None, now=None, extra_contexts=None)
Verify the embedded ecdsa-rdfc-2019 proof end to end.
Key selection, proof-purpose authorization, presentation binding and the
validity window behave exactly as
:meth:~openvc.proof.data_integrity.DataIntegrityProofSuite.verify; only the
signature algebra (ECDSA, curve chosen by the resolved key) differs. The
curve-selected digest and the accepted JWK kty/crv follow from the key
via _match_alg, so a cross-type key fails closed before the crypto runs.
Source code in src/openvc/proof/di_ecdsa_rdfc.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
Data Integrity — ecdsa-sd-2023 (selective disclosure)
openvc.proof.ecdsa_sd
openvc.proof.ecdsa_sd — Data Integrity cryptosuite ecdsa-sd-2023
(W3C VC Data Integrity ECDSA Cryptosuites): selective disclosure over P-256.
The third Data Integrity cryptosuite alongside eddsa-rdfc-2022. Where that one
signs the whole canonical document once, ecdsa-sd-2023 lets an issuer sign each
statement so a holder can later reveal only a chosen subset:
issuer -> add_base_proof(doc, mandatoryPointers) (a base proof)
holder -> derive_proof(base, selectivePointers) (a derived proof)
verifier-> verify(derived) (checks the disclosed subset)
The proof value is a multibase (u) CBOR blob. Base proof:
0xd95d00 ‖ CBOR([baseSignature, publicKey, hmacKey, signatures, mandatoryPointers]);
derived proof:
0xd95d01 ‖ CBOR([baseSignature, publicKey, signatures, compressedLabelMap,
mandatoryIndexes]). Blank-node labels are blinded with HMAC-SHA256; per-statement
signatures use an ephemeral proof-scoped P-256 key.
Status: interop-validated against the official W3C vc-di-ecdsa test vectors —
verify accepts reference-produced derived proofs, and the issuer-side
canonical N-Quads and proofHash / mandatoryHash match the recorded
intermediates byte for byte (tests/fixtures/ecdsa_sd/). ECDSA signatures are
randomised, so — unlike eddsa-rdfc-2022 — interop is shown this way rather
than by reproducing a fixed proof value.
This module reuses the P-256 backend and the SSRF-safe offline canonicalization of
the other suites; it needs the [data-integrity] extra (pyld). CBOR is a small
hand-rolled codec for the fixed proof-value shape (no new dependency), like the
project's own varint/base58.
CredentialExpired
Bases: ProofError
The credential's validity window has ended (validUntil / expirationDate / proof expires).
Source code in src/openvc/proof/errors.py
53 54 | |
CredentialNotYetValid
Bases: ProofError
The credential's validity window has not started (validFrom / issuanceDate).
Source code in src/openvc/proof/errors.py
57 58 | |
KeyResolutionError
Bases: ProofError
The proof's verificationMethod key could not be resolved.
Source code in src/openvc/proof/errors.py
69 70 | |
MalformedTimestamp
Bases: ProofError
A validity timestamp is present but not a parseable date-time (fails closed).
Source code in src/openvc/proof/errors.py
61 62 | |
ProofPurposeMismatch
Bases: ProofError
The proof's proofPurpose is not the expected one (e.g. assertionMethod).
Source code in src/openvc/proof/errors.py
65 66 | |
ProofMalformed
Bases: ProofError
The proof object is structurally invalid — missing or wrongly typed fields.
Source code in src/openvc/proof/errors.py
31 32 | |
SignatureInvalid
Bases: ProofError
A proof/signature did not verify.
Source code in src/openvc/proof/errors.py
27 28 | |
UnsupportedCryptosuite
Bases: ProofError
The proof declares a cryptosuite this suite does not implement.
Source code in src/openvc/proof/errors.py
35 36 | |
EcdsaSdProofSuite
Issue (base), derive (holder), and verify ecdsa-sd-2023 selective-disclosure Data Integrity proofs over P-256.
Source code in src/openvc/proof/ecdsa_sd.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | |
add_base_proof(credential, *, signing_key, verification_method, mandatory_pointers, proof_purpose='assertionMethod', created=None, extra_contexts=None)
Issuer side: sign each statement so a holder can later disclose a subset. mandatory_pointers are always revealed. Needs an ES256 (P-256) key.
Security note: the verifier's validity-window check can only see what the
holder discloses. If this credential carries validFrom / validUntil
(or issuanceDate / expirationDate) and you want a verifier to
enforce them, include those pointers here — otherwise a holder may withhold
the window from the derived proof and expiry goes unchecked. The W3C
reference vectors mark the validity window mandatory for this reason.
Source code in src/openvc/proof/ecdsa_sd.py
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | |
derive_proof(secured, *, selective_pointers, extra_contexts=None)
Holder side: reveal only the mandatory + selective_pointers statements.
Source code in src/openvc/proof/ecdsa_sd.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 | |
verify(derived, *, public_key_jwk=None, resolver=None, expected_proof_purpose='assertionMethod', now=None, extra_contexts=None)
Verify a derived proof: the issuer's base signature over the mandatory statements, and the per-statement signatures over each disclosed one.
Key selection and policy match :meth:DataIntegrityProofSuite.verify:
public_key_jwk pins an operator-trusted key, else the P-256
verificationMethod resolves via resolver (falling back to offline
did:key) and must be authorized for expected_proof_purpose. After
the signatures verify, the proof's proofPurpose and the disclosed
credential's validity window (with the suite's leeway, evaluated at now)
are enforced — a derived proof only reveals a subset, so these bounds are
checked against whatever the holder disclosed.
Source code in src/openvc/proof/ecdsa_sd.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | |
encode_cbor(obj)
Encode obj as the deterministic CBOR subset the proof value uses. Rejects
anything outside that subset (bool / negative / tag / null / …) with
:class:EcdsaSdError — the shared :mod:openvc.cbor codec is more permissive.
Source code in src/openvc/proof/ecdsa_sd.py
124 125 126 127 128 129 130 131 132 | |
decode_cbor(data)
Decode a proof-value CBOR item; raises :class:ProofValueMalformed on malformed
bytes or on any value outside the ecdsa-sd subset (a tag, bool, null, or negative).
Source code in src/openvc/proof/ecdsa_sd.py
135 136 137 138 139 140 141 142 143 | |
p256_public_multikey(jwk)
A P-256 public JWK -> 35-byte multikey (0x8024 ‖ 33-byte compressed point).
Source code in src/openvc/proof/ecdsa_sd.py
150 151 152 153 154 155 156 157 158 159 160 161 | |
p256_multikey_to_jwk(multikey)
A 35-byte P-256 multikey -> public JWK.
Source code in src/openvc/proof/ecdsa_sd.py
164 165 166 167 168 169 170 171 172 173 174 | |
hmac_label(hmac_key, canonical_label)
The blinded label for a canonical blank-node id (e.g. c14n0):
u + base64url-no-pad( HMAC-SHA256(hmac_key, utf8(label)) ).
Source code in src/openvc/proof/ecdsa_sd.py
181 182 183 184 185 | |
compress_label_map(label_map)
{"c14nN": "u
Source code in src/openvc/proof/ecdsa_sd.py
188 189 190 191 192 193 194 195 | |
decompress_label_map(compressed)
{N:
Source code in src/openvc/proof/ecdsa_sd.py
198 199 200 | |
encode_base_proof(*, base_signature, public_key, hmac_key, signatures, mandatory_pointers)
Serialise an ecdsa-sd-2023 base proof value (issuer side).
Source code in src/openvc/proof/ecdsa_sd.py
207 208 209 210 211 212 213 214 | |
decode_base_proof(proof_value)
Parse an ecdsa-sd-2023 base proof value into its parts.
Source code in src/openvc/proof/ecdsa_sd.py
217 218 219 220 221 222 223 224 225 226 227 228 | |
encode_derived_proof(*, base_signature, public_key, signatures, label_map, mandatory_indexes)
Serialise an ecdsa-sd-2023 derived proof value (holder side).
Source code in src/openvc/proof/ecdsa_sd.py
231 232 233 234 235 236 237 238 239 | |
decode_derived_proof(proof_value)
Parse an ecdsa-sd-2023 derived proof value into its parts.
Source code in src/openvc/proof/ecdsa_sd.py
242 243 244 245 246 247 248 249 250 251 252 253 254 | |
Data Integrity — eddsa-jcs-2022 / ecdsa-jcs-2019 (RFC 8785 JCS, no pyld)
openvc.proof.di_jcs
openvc.proof.di_jcs — the JCS Data Integrity cryptosuites (eddsa-jcs-2022 and
ecdsa-jcs-2019).
Same Data Integrity flow as :mod:openvc.proof.data_integrity — ::
hashData = SHA-256(canonicalize(proofConfig)) ‖ SHA-256(canonicalize(unsecuredDocument))
sign it, embed the signature as a multibase proofValue — but the canonical
form is RFC 8785 JCS (:mod:openvc.proof._jcs) instead of RDF N-Quads. That
makes these a whole-document Data Integrity path with no pyld dependency:
the JCS suites canonicalize pure-stdlib. eddsa-jcs-2022 signs Ed25519;
ecdsa-jcs-2019 signs ECDSA over SHA-256 (P-256) or SHA-384 (P-384) — raw R‖S,
like the JOSE path — the digest chosen by the key's curve.
The two suites share every step except the key algorithm, so they are one base
class parameterised by (_cryptosuite, _alg); :class:DataIntegrityProofSuite
(the RDF eddsa-rdfc-2022 path, pinned byte-for-byte to the W3C vectors) is left
untouched.
EddsaJcsProofSuite
Bases: _JcsProofSuite
Data Integrity eddsa-jcs-2022: Ed25519 over RFC 8785 JCS (no pyld).
Source code in src/openvc/proof/di_jcs.py
212 213 214 215 216 | |
EcdsaJcsProofSuite
Bases: _JcsProofSuite
Data Integrity ecdsa-jcs-2019: ECDSA over RFC 8785 JCS (no pyld).
Whole-document (non-selective) ECDSA Data Integrity — P-256/SHA-256 (ES256) or
P-384/SHA-384 (ES384), selected by the signing/verification key's curve. Unlike
its selective-disclosure sibling :mod:openvc.proof.ecdsa_sd it needs no pyld.
Source code in src/openvc/proof/di_jcs.py
219 220 221 222 223 224 225 226 227 228 | |
VP-JWT — holder presentations
openvc.proof.vp_jwt
openvc.proof.vp_jwt — Verifiable Presentation in JWT form (VP-JWT).
A holder wraps one or more credentials in a vp object and signs it: this
proves possession of the holder key and binds the presentation to a specific
verifier (aud) and a one-time challenge (nonce) so it cannot be replayed.
holder -> sign(credentials, holder_key, audience, nonce) (a VP-JWT)
verifier-> verify(vp, ..., audience, nonce) (holder sig + aud/nonce
+ every embedded VC)
Verification checks the holder signature (allow-listed {ES256, ES384, EdDSA, Ed25519}), the
temporal claims, aud and nonce, then verifies each embedded credential
through the generic pipeline (:func:openvc.verify.verify_credential) — so a VP
is only accepted when the holder is authentic and every credential in it is.
The holder key is resolved from the untrusted iss/kid via an injected
resolver (as in the pipeline), or pinned with holder_key_jwk.
VerifiedPresentation
dataclass
A successfully verified VP-JWT.
Source code in src/openvc/proof/vp_jwt.py
34 35 36 37 38 39 40 | |
VpJwtProofSuite
Sign and verify VP-JWT holder presentations.
Source code in src/openvc/proof/vp_jwt.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
peek_holder(vp_jwt)
Return (holder, kid) WITHOUT verifying. UNTRUSTED — use only to select which key to resolve.
Source code in src/openvc/proof/vp_jwt.py
51 52 53 54 55 56 57 | |
sign(credentials, *, holder_key, audience, nonce, holder=None, expires_in_s=None)
Wrap credentials (VC-JWT / SD-JWT strings, or Data Integrity dicts) in a VP-JWT signed by holder_key, bound to audience and nonce.
Source code in src/openvc/proof/vp_jwt.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
verify(vp_jwt, *, audience, nonce, holder_key_jwk=None, resolver=None, expected_holder=None, require_holder_binding=False, **credential_verify_kwargs)
Verify a VP-JWT end to end: the holder signature, temporal claims,
aud and nonce, then every embedded credential via
:func:openvc.verify.verify_credential (passing resolver and any
credential_verify_kwargs, e.g. policy= / resolve_status_list=).
The holder key is holder_key_jwk if given, else resolved from the peeked
iss/kid through resolver.
Holder binding. By default (require_holder_binding=False) this proves
the holder signed the presentation and each credential is valid, but does
NOT require the credentials to have been issued to that holder — a holder can
legitimately present a third party's credential. Set
require_holder_binding=True to additionally require every embedded
credential's credentialSubject.id to equal the holder, so a presenter
cannot pass off a credential issued to someone else as their own. (Off by
default to match SdJwtVcProofSuite's require_key_binding.) The
holder's identity is authenticated only in resolver mode (the key is
resolved from iss); with a pinned holder_key_jwk the iss
is signer-supplied, so expected_holder must be given to bind and to trust
the returned holder. expected_holder, if set, requires iss to equal
it. audience and nonce are required and must be non-empty — VP-JWT has
no unbound mode.
Source code in src/openvc/proof/vp_jwt.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |