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.) Two explicit, per-suite opt-ins add names and nothing else:allow_pq=Truethe experimental ML-DSA set, andallow_es256k=Truethe single nameES256K(RFC 8812, ECDSA over secp256k1 with SHA-256), which EBSI Core API v1 uses for its RootTAO accreditations.ES256Kis VERIFY-ONLY (this module never signs it) and never in :data:ALLOWED_ALGS; neither opt-in implies the other.allow_pqandallow_es256kmust each be exactlyTrueorFalse(a string such as"false"from a configuration file is refused, not read as true), and an ES256K JWK is held to RFC 8812 section 3.2:alg,useandkey_ops, when present, must beES256K,sigand an array includingverify. - 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.
- Explicit typing: a JWS typed as an SD-JWT issuer JWT or a KB-JWT, or whose payload
carries an SD-JWT marker (
_sd,_sd_alg,"...") at any depth, is a MalformedToken before the signature is checked (#189, #291). The markers are reserved by RFC 9901 §4.1 item 7 (_sdand...), §4.2.4.2 (the{"...": digest}array-element object) and §4.1.1 (_sd_alg, top level only).
ClaimsInvalid
Bases: ProofError
A required claim is missing, malformed, or does not satisfy policy.
Source code in src/openvc/proof/errors.py
51 52 | |
MalformedToken
Bases: ProofError
A compact JWS / SD-JWT string is not well-formed.
Source code in src/openvc/proof/errors.py
47 48 | |
ProofError
Bases: OpenvcError
Base class for every proof-suite failure (signature, format, temporal, policy).
Source code in src/openvc/proof/errors.py
27 28 | |
SignatureInvalid
Bases: ProofError
A proof/signature did not verify.
Source code in src/openvc/proof/errors.py
31 32 | |
UnsupportedAlgorithm
Bases: ProofError
The JOSE algorithm is not in the {ES256, ES384, EdDSA, Ed25519} allow-list.
Source code in src/openvc/proof/errors.py
43 44 | |
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
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
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
125 126 | |
VcJwtProofSuite
VC-JWT (JOSE-secured Verifiable Credential) proof suite.
Source code in src/openvc/proof/vc_jwt.py
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 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 | |
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
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 | |
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
360 361 362 363 364 365 366 367 368 369 370 | |
verify(token, *, public_key_jwk, expected_types=None, audience=None, check_temporal=True)
Verify signature + temporal claims + VC-JWT reconciliation.
check_temporal False waives only the expiry checks (JWT exp, and the
body's validUntil / expirationDate); the result's expired then
reports whether one of them would have failed.
Source code in src/openvc/proof/vc_jwt.py
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 | |
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
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 | |
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-18 (the VC profile:
vct,aka_vcts,cnf,status…; a draft that builds on RFC 9901)
The same suite verifies a W3C VCDM credential secured as SD-JWT (VC-JOSE-COSE §3.2:
vc+sd-jwt, the draft-era vc+ld+json+sd-jwt, or no typ), accepted only as a
conforming VCDM payload (#275).
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), and dates it: its iat is required and must
fall within kb_max_age_s of the verifier's now (RFC 9901 §7.3 step 5.5).
Revocation: the suite itself does not check status. :func:openvc.verify.verify_credential
does (an SD-JWT VC's status claim carrying an IETF Token Status List reference, or a
W3C credentialStatus), fail-closed by default; called directly, 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
125 126 | |
SdJwtVcProofSuite
SD-JWT VC issuance, holder presentation, and verification.
Source code in src/openvc/proof/sd_jwt.py
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 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | |
peek_issuer(sd_jwt)
Return (iss, kid) from the issuer-signed JWT WITHOUT verifying. UNTRUSTED — use only to select which key to resolve.
For a W3C credential (typ absent, vc+sd-jwt or vc+ld+json+sd-jwt) whose
body has no iss at all, the first item is the VCDM issuer (a string, or an
object's id): VC-JOSE-COSE §4.1.2 makes iss optional there (#290). Stricter
than the VC-JWT lane's peek, which reads vc.issuer for any falsy iss: only
when iss is ABSENT, and an object's id / @id must all agree. A
dc+sd-jwt still needs iss.
Source code in src/openvc/proof/sd_jwt.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | |
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).
It refuses (SdJwtError, nothing signed) the claims a verifier needs to judge
validity, since a holder could withhold them undetected: iss, nbf,
exp, cnf, vct, vct#integrity, aka_vcts and status
(draft-ietf-oauth-sd-jwt-vc-19 §2.2.2.3), credentialStatus and @context,
and — when @context makes the payload a W3C VCDM credential — validFrom,
validUntil, issuanceDate and expirationDate. 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
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 | |
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
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | |
verify(presentation, *, public_key_jwk, audience=None, nonce=None, require_key_binding=False, expected_vct=None, check_temporal=True, kb_max_age_s=DEFAULT_KB_MAX_AGE_S, now=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.
audience and nonce bind a KB-JWT together (RFC 9901 §7.3 step 5.6):
pass both, as non-empty strings. A present KB-JWT verified with only one of
them, or with an empty one, raises ClaimsInvalid rather than report a
half-checked binding. With neither, key_bound=True proves possession of the
cnf key over these disclosures for some verifier, not a binding to you.
Rejecting a half-bound KB-JWT does not make it required: a presentation with
the KB-JWT stripped still verifies with key_bound=False, so set
require_key_binding (or check key_bound) when you need the binding.
When require_key_binding is True the KB-JWT is verified before
exp/nbf: an expired (or not-yet-valid) issuer JWT still has its
holder binding checked, so a temporal failure means the presentation was
bound and a key-binding failure means it was not. The hosted path
(require_key_binding False) is unchanged — temporal still runs before
any optional KB-JWT.
Any KB-JWT that is present is held to RFC 9901 §7.3 step 5.5: its iat is
required, must be a finite number, must not be older than kb_max_age_s (plus
the suite leeway) and must not be in the future beyond the leeway. now pins
the instant that window is evaluated at (a naive datetime is UTC). To re-check
an archived presentation, pin it to the receipt time your system recorded —
never to a value read from the presentation itself: its own iat would make
every KB-JWT fresh and switch the window off. The issuer JWT's exp/nbf/iat
still use the current time, as on every JOSE suite.
The issuer JWT typ is dc+sd-jwt (an IETF SD-JWT VC) or vc+sd-jwt
(VC-JOSE-COSE §6.1.3). The draft-era vc+ld+json+sd-jwt of the Recommendation's
Example 21 and an absent typ (a SHOULD there; its Examples 4 and 5 omit it) are
accepted like vc+sd-jwt. All of these but dc+sd-jwt are accepted only for
a payload that conforms to the VCDM (#275): a VCDM base @context somewhere in it
(otherwise SdJwtError), as the FIRST @context entry (VCDM 2.0 §4.3), and a
type that includes VerifiableCredential and not VerifiablePresentation
(§4.5, §4.13), each with its own SdJwtError message; a withheld type fails the
second. Nothing more is tested: issuer and credentialSubject are not required.
A typ that is present and anything else, null included, raises SdJwtError
too, and so does an absent one on a payload with a vc or vp claim (§3.1.3).
When the payload names a VCDM @context anywhere (whatever the typ, a
dc+sd-jwt included), it is a W3C VCDM credential for what follows, and its
validFrom / validUntil are enforced too, like the VC-JWT suite does (current
time, same leeway; check_temporal=False waives only the expiry). Its iss /
jti / sub must not conflict with issuer / id /
credentialSubject.id either, as on the VC-JWT suite (ClaimsInvalid). An IETF
SD-JWT VC's claims are never read as a VCDM validity window or reconciled with them.
The issuer JWT's exp/nbf/iat, and any disclosed iat, must each be
a finite JSON number when present (null included). An iat more than the
leeway in the future is rejected. check_temporal waives only an expired exp.
The issuer JWT's own aud, when it has one, is held to RFC 7519 §4.1.3 (ADR-0008
D4): it must be a string or an array of strings, and the audience you pass must be
one of them, else ClaimsInvalid. With no audience a credential that names an
audience is refused, since you cannot be one of them. An issuer JWT with no aud
verifies as before, with or without an audience. The check reads the processed
payload, runs after the KB-JWT when binding is required, is not an expiry (so
check_temporal does not waive it, and its message does not describe an expiry), and
cannot see an aud disclosure the holder withholds. The KB-JWT's aud is a
separate check: it binds the holder's presentation, not the issuer's restriction.
A presented disclosure of a claim :meth:issue refuses to make disclosable — or of
any sub-claim of one, array elements included — raises SdJwtError: the issuer
made it withholdable. That catches the non-conformant issuer only when the holder
presents the disclosure; a withheld one is indistinguishable from a decoy (RFC
9901 §9.7), so a third-party credential whose exp or status was disclosable
still verifies when the holder omits it. Besides the issuer identifier (iss, or for
a W3C credential with no iss its VCDM issuer, #290), without which nothing
verifies, the detectable case is vct: it is REQUIRED, so a dc+sd-jwt whose
processed payload has none raises ClaimsInvalid, even one that also carries a
VCDM @context. With require_key_binding, a disclosed cnf fails earlier,
as the key-binding ClaimsInvalid (no cnf.jwk in the issuer JWT).
Source code in src/openvc/proof/sd_jwt.py
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 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | |
make_object_disclosure(salt, name, value)
Encode an object-property disclosure [salt, name, value].
Source code in src/openvc/proof/sd_jwt.py
155 156 157 | |
make_array_disclosure(salt, value)
Encode an array-element disclosure [salt, value].
Source code in src/openvc/proof/sd_jwt.py
160 161 162 | |
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
165 166 167 168 169 170 171 172 | |
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
57 58 | |
CredentialNotYetValid
Bases: ProofError
The credential's validity window has not started (validFrom / issuanceDate).
Source code in src/openvc/proof/errors.py
61 62 | |
KeyResolutionError
Bases: ProofError, KeyResolutionFailed
The proof's verificationMethod key could not be resolved.
Raised by every Data Integrity lane, sync and async. It is both a :class:ProofError
and the pipeline's :class:~openvc.errors.KeyResolutionFailed (hence also a
:class:~openvc.errors.VerificationError), so except ProofError, except
KeyResolutionFailed and except VerificationError each catch it. The JOSE lanes
raise the plain KeyResolutionFailed, which is not a ProofError, so
except KeyResolutionError and except ProofError still do not catch a JOSE
failure.
Source code in src/openvc/proof/errors.py
73 74 75 76 77 78 79 80 81 82 | |
MalformedTimestamp
Bases: ProofError
A validity timestamp is present but not a parseable date-time (fails closed).
Source code in src/openvc/proof/errors.py
65 66 | |
PresentationBindingError
Bases: ProofError
A presentation proof's challenge / domain does not match what the verifier expects.
Source code in src/openvc/proof/errors.py
85 86 | |
ProofPurposeMismatch
Bases: ProofError
The proof's proofPurpose is not the expected one (e.g. assertionMethod).
Source code in src/openvc/proof/errors.py
69 70 | |
ProofMalformed
Bases: ProofError
The proof object is structurally invalid — missing or wrongly typed fields.
Source code in src/openvc/proof/errors.py
35 36 | |
SignatureInvalid
Bases: ProofError
A proof/signature did not verify.
Source code in src/openvc/proof/errors.py
31 32 | |
UnsupportedCryptosuite
Bases: ProofError
The proof declares a cryptosuite this suite does not implement.
Source code in src/openvc/proof/errors.py
39 40 | |
DataIntegrityProofSuite
Sign and verify credentials with an embedded eddsa-rdfc-2022 proof.
Source code in src/openvc/proof/data_integrity.py
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 | |
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.
created is a datetime or None (the current UTC time): a naive value is
UTC, never the host's local time, an aware one is converted, and the signed
string is whole seconds (truncated). Anything else, or a value with no UTC
equivalent, is :class:ProofMalformed before anything is signed. No openvc
verifier reads created back.
Source code in src/openvc/proof/data_integrity.py
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 | |
verify(secured, *, public_key_jwk=None, resolver=None, expected_proof_purpose='assertionMethod', expected_challenge=None, expected_domain=None, now=None, extra_contexts=None, check_temporal=True)
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
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 | |
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
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 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
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.
created is a datetime or None (the current UTC time): a naive value is
UTC, never the host's local time, an aware one is converted, and the signed
string is whole seconds (truncated). Anything else, or a value with no UTC
equivalent, is :class:ProofMalformed before anything is signed. No openvc
verifier reads created back.
Source code in src/openvc/proof/di_ecdsa_rdfc.py
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 | |
verify(secured, *, public_key_jwk=None, resolver=None, expected_proof_purpose='assertionMethod', expected_challenge=None, expected_domain=None, now=None, extra_contexts=None, check_temporal=True)
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
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 | |
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
57 58 | |
CredentialNotYetValid
Bases: ProofError
The credential's validity window has not started (validFrom / issuanceDate).
Source code in src/openvc/proof/errors.py
61 62 | |
KeyResolutionError
Bases: ProofError, KeyResolutionFailed
The proof's verificationMethod key could not be resolved.
Raised by every Data Integrity lane, sync and async. It is both a :class:ProofError
and the pipeline's :class:~openvc.errors.KeyResolutionFailed (hence also a
:class:~openvc.errors.VerificationError), so except ProofError, except
KeyResolutionFailed and except VerificationError each catch it. The JOSE lanes
raise the plain KeyResolutionFailed, which is not a ProofError, so
except KeyResolutionError and except ProofError still do not catch a JOSE
failure.
Source code in src/openvc/proof/errors.py
73 74 75 76 77 78 79 80 81 82 | |
MalformedTimestamp
Bases: ProofError
A validity timestamp is present but not a parseable date-time (fails closed).
Source code in src/openvc/proof/errors.py
65 66 | |
ProofPurposeMismatch
Bases: ProofError
The proof's proofPurpose is not the expected one (e.g. assertionMethod).
Source code in src/openvc/proof/errors.py
69 70 | |
ProofMalformed
Bases: ProofError
The proof object is structurally invalid — missing or wrongly typed fields.
Source code in src/openvc/proof/errors.py
35 36 | |
SignatureInvalid
Bases: ProofError
A proof/signature did not verify.
Source code in src/openvc/proof/errors.py
31 32 | |
UnsupportedCryptosuite
Bases: ProofError
The proof declares a cryptosuite this suite does not implement.
Source code in src/openvc/proof/errors.py
39 40 | |
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
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 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | |
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.
created is a datetime or None (the current UTC time): a naive value is
UTC, never the host's local time, an aware one is converted, and the signed
string is whole seconds (truncated). Anything else, or a value with no UTC
equivalent, is :class:ProofMalformed before anything is signed. No openvc
verifier reads created back.
Raises :class:ProofMalformed if the credential cannot be canonicalized: an
@context that is neither bundled nor passed via extra_contexts, or one
JSON-LD refuses (the escaping class used to be pyld's JsonLdError).
A signing-backend error is not wrapped: it surfaces as itself.
Source code in src/openvc/proof/ecdsa_sd.py
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 | |
derive_proof(secured, *, selective_pointers, extra_contexts=None)
Holder side: reveal only the mandatory + selective_pointers statements.
Raises :class:ProofMalformed if the credential cannot be canonicalized: an
@context that is neither bundled nor passed via extra_contexts, or one
JSON-LD refuses (the escaping class used to be pyld's JsonLdError).
A pointer that does not resolve is :class:EcdsaSdError.
Source code in src/openvc/proof/ecdsa_sd.py
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 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | |
verify(derived, *, public_key_jwk=None, resolver=None, expected_proof_purpose='assertionMethod', now=None, extra_contexts=None, check_temporal=True)
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
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 | |
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
129 130 131 132 133 134 135 136 137 | |
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
140 141 142 143 144 145 146 147 148 | |
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
155 156 157 158 159 160 161 162 163 164 165 166 | |
p256_multikey_to_jwk(multikey)
A 35-byte P-256 multikey -> public JWK.
Source code in src/openvc/proof/ecdsa_sd.py
169 170 171 172 173 174 175 176 177 178 179 | |
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
186 187 188 189 190 | |
compress_label_map(label_map)
{"c14nN": "u
Source code in src/openvc/proof/ecdsa_sd.py
193 194 195 196 197 198 199 200 | |
decompress_label_map(compressed)
{N:
Source code in src/openvc/proof/ecdsa_sd.py
203 204 205 | |
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
212 213 214 215 216 217 218 219 | |
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
222 223 224 225 226 227 228 229 230 231 232 233 | |
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
236 237 238 239 240 241 242 243 244 | |
decode_derived_proof(proof_value)
Parse an ecdsa-sd-2023 derived proof value into its parts.
Each part must have the type VC-DI-ECDSA's parseDerivedProofValue gives it:
base_signature and public_key byte strings, signatures an array of byte
strings, the compressed label map a map of unsigned integers to byte strings and
mandatory_indexes an array of unsigned integers. Anything else raises
:class:ProofValueMalformed here, before :meth:EcdsaSdProofSuite.verify uses it.
The holder chooses these bytes, and no key is needed to send them, so a wrong type
would otherwise surface as a bare TypeError / AttributeError that aborts a
whole verify_many batch.
The label map must also be injective. Two blank nodes of the disclosed document mapped to one HMAC label are one node to the signature and two to the JSON that every check after it reads, so a holder could describe one signed node (a status entry) in two places. A genuine derived proof never repeats a label: the disclosed blank nodes are distinct nodes of the issuer's document.
Source code in src/openvc/proof/ecdsa_sd.py
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 | |
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
224 225 226 227 228 | |
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
231 232 233 234 235 236 237 238 239 240 | |
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, defaulting to its default_resolver), or pinned
with holder_key_jwk. The resolver also serves the embedded credentials' issuers.
Before the holder key is resolved, verify applies the algorithm allow-list, the
crit check and the same explicit-typing and SD-JWT-marker tests as the VC-JWT lane to
the presentation (#291).
VerifiedPresentation
dataclass
A successfully verified VP-JWT.
Source code in src/openvc/proof/vp_jwt.py
51 52 53 54 55 56 57 | |
VpJwtProofSuite
Sign and verify VP-JWT holder presentations.
Source code in src/openvc/proof/vp_jwt.py
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 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 | |
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
68 69 70 71 72 | |
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
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 | |
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. resolver defaults to
:func:openvc.verify.default_resolver, as in verify_credential. A pinned
holder key never goes through it, but the embedded credentials' issuers
still do.
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.
A VP with no verifiableCredential (VCDM allows one, e.g. DID Auth) verifies
with an empty credentials tuple — a caller that needs a credential must check
for one (:func:openvc.openid4vp.verify_vp_token does). A
verifiableCredential that is neither a credential nor an array (a number,
a bool, null) raises ClaimsInvalid.
Nested SD-JWT VCs. An embedded SD-JWT VC (bare, or inside an
EnvelopedVerifiableCredential) that carries a Key Binding JWT has it
verified against this presentation's audience and nonce — whatever
audience/nonce a passed policy holds — so its result's
key_bound=True means bound to this exchange. A KB-JWT made for another
verifier or nonce fails the whole presentation (ClaimsInvalid). One with no
KB-JWT reports key_bound=False: the VP signature authenticates the presenter,
never the credential's cnf key. If you need that, pass
policy=VerificationPolicy(require_key_binding=True), or use
require_holder_binding.
Source code in src/openvc/proof/vp_jwt.py
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 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 | |