Skip to content

Post Quantum

github-actions[bot] edited this page Dec 5, 2026 · 1 revision

Experimental support for ML-DSA (FIPS 204), the NIST post-quantum signature algorithm, in OpenBadges 3.0 JWT-VC and SD-JWT VC credentials. It is experimental: the surface may change in a minor release. ML-DSA is permitted by OB 3.0 section 8.2.3 but limits interoperability, and it is outside the proof mechanisms the 1EdTech conformance test suite covers (see Interoperability caveats). Nothing here changes the classical algorithms, which stay the default.

What it is

  • Algorithm: ML-DSA (FIPS 204, final August 2024), parameter sets ML-DSA-44, ML-DSA-65 and ML-DSA-87.
  • JOSE binding: RFC 9964 "ML-DSA for JOSE and COSE" registers the JWS alg values ML-DSA-44, ML-DSA-65 and ML-DSA-87 and the JWK key type AKP (members alg, pub, and priv, a 32-byte seed that never appears in a public key). The library signs pure ML-DSA with an empty context string; HashML-DSA is not defined for JOSE. The JWK thumbprint members are alg, kty, pub.
  • Key files: the private key is an unencrypted PKCS#8 PEM in the seed form (RFC 9881 section 6 recommends it); the public key is a SubjectPublicKeyInfo PEM. Both are ordinary PRIVATE KEY / PUBLIC KEY PEM files, so the rest of the key handling (openbadges-keygenerator, public_key = in the config) works as for any other key.
  • One key, one algorithm: the parameter set is the algorithm. An ML-DSA-44 key never signs or verifies as ML-DSA-65, and an ML-DSA key never works under a classical alg.
  • Requirement: a cryptography built with ML-DSA support (official PyPI wheels have it since 48.0.0; the project floor is already >=50, see Installation). A build linked against an OpenSSL without ML-DSA imports fine but cannot generate, sign or verify; the keygenerator then exits with [!] Could not generate the ML-DSA-65 key: ….
  • PyJWT: PyJWT has no ML-DSA. The library registers the three algorithms on a private PyJWT instance and leaves PyJWT's global algorithm registry untouched, so importing openbadgeslib does not make another library's jwt.decode accept ML-DSA tokens.
Parameter set Public key Signature
ML-DSA-44 1312 bytes 2420 bytes
ML-DSA-65 1952 bytes 3309 bytes
ML-DSA-87 2592 bytes 4627 bytes

Tokens and baked images grow accordingly: a JWT-VC embeds the issuer's public JWK, so an ML-DSA-65 token carries both a 3309-byte signature and a 1952-byte public key, base64url-encoded. The minimal credential of examples/ob3_jwt_vc_mldsa.py came to 9433 characters.

What is implemented

Area Support
OB 3.0 JWT-VC (proof_format = vc-jwt), issue and verify Yes, baked into SVG and PNG as for any other key
Bitstring Status List credentials Yes, signed with the badge key by openbadges-publish -V 3
did:web documents (openbadges-publish -V 3) Yes, the key is published as an AKP publicKeyJwk
did:jwk Yes (did_jwk_from_jwk accepts an AKP JWK that loads as a public key)
SD-JWT VC (openbadgeslib.ob3.eudi, via openvc-core) Yes, issue and verify; see the limits below
OID4VCI issuer metadata Yes: credential_signing_alg_values_supported lists the key's own ML-DSA-* alg for jwt_vc_json and vc+sd-jwt

Issuing opts in by choosing the key type. There is no flag: an ML-DSA key_type (or algorithm='ML-DSA-65' in the API) is the issuer's decision.

Verifying requires an explicit opt-in: allow_pq=True in the API, --allow-pq on openbadges-verifier. Without it an ML-DSA key is refused with OB3VerificationError ("ML-DSA (RFC 9964) verification is experimental and requires allow_pq=True") before any signature work. The flag must be exactly True or False; a truthy string such as "false" from a config file raises instead of switching the feature on. It widens nothing for other keys: RSA, EC and Ed25519 keys verify exactly as without it.

Quick start (CLI)

Set key_type in the badge section of config.ini (the file names are your choice):

[badge_1]
; ... the usual keys ...
private_key = ${paths:base_key}/sign_mldsa65_key_1.pem
public_key  = ${paths:base_key}/verify_mldsa65_key_1.pem
key_type    = ML-DSA-65

key_type accepts ML-DSA-44, ML-DSA-65 and ML-DSA-87 (case-insensitive; ML_DSA_65 and MLDSA65 are also read). Then generate, sign and verify:

openbadges-keygenerator -c ./config/config.ini -g 1
openbadges-signer -c ./config/config.ini -b 1 -r recipient@example.com -E -o /tmp/ -V 3
openbadges-verifier -i /tmp/badge_1_recipient@example.com.svg -r recipient@example.com -V 3 \
    -k ./config/keys/verify_mldsa65_key_1.pem --allow-pq
[+] OB3 signature is valid for the identity recipient@example.com

Without --allow-pq the same command fails closed:

[-] OB3 verification failed: ML-DSA (RFC 9964) verification is experimental and requires allow_pq=True
[i] Re-run with --allow-pq to accept experimental ML-DSA (RFC 9964) signatures.

--allow-pq also applies to -l BADGE and --resolve-did (a did:web issuer whose document lists an AKP key), and to --check-status: the status list is signed with the badge key, so it is verified under the same opt-in. --allow-pq with -V 1 or -V 2 is an error, as are the other OB3-only flags.

openbadges-signer needs no new option, but for ML-DSA the key files must match the config: the badge's key_type, the private key and the public key must name the same parameter set, and the public key must be the private key's own public half, or the badge is refused before anything is signed. ML-DSA must be an explicit choice, so ML-DSA key files in a section with no key_type line (which means the default, RSA) are refused with a message to set it. Classical keys stay as lenient as before (an ED25519 name over RSA key files still signs RS256). openbadges-publish -V 3 publishes the public key in did.json and signs the status lists with the badge key.

One did:web issuer, several badge keys. did.json lists one verification method per badge, in config order. A JWT-VC token issued by this library carries no kid header (its header is alg, jwk and typ only), so a verifier that resolves the issuer's did:web (--resolve-did, OB3Verifier.for_issuer_did) checks it against the document's first verification method. For a did:web issuer that publishes several badge keys, only the badge listed first verifies through DID resolution. This is not specific to ML-DSA: two RSA badges on one issuer behave the same way. Verify the other badges with their key file (-k FILE, or -l BADGE), or use a separate did:web per key type.

Quick start (Python)

from openbadgeslib.keys import KeyFactory, KeyType
from openbadgeslib.ob3 import (Achievement, Issuer, OB3Signer, OB3Verifier,
                               OpenBadgeCredential)

priv_pem, pub_pem = KeyFactory(KeyType.ML_DSA_65).generate_keypair()

credential = OpenBadgeCredential(
    issuer=Issuer(id='https://issuer.example/organization.json',
                  name='Example University'),
    recipient_id='mailto:learner@example.com',
    achievement=Achievement(
        id='https://issuer.example/badges/python-101',
        name='Python 101',
        description='Completed the introductory Python course.',
        criteria_narrative='Passed all assignments and the final project.'))

token = OB3Signer(privkey_pem=priv_pem, algorithm='ML-DSA-65').sign(credential)

# OB3Verifier(pubkey_pem=pub_pem) raises OB3VerificationError: no opt-in.
verified = OB3Verifier(pubkey_pem=pub_pem, allow_pq=True).verify(
    token, expected_recipient='learner@example.com')

The runnable version is examples/ob3_jwt_vc_mldsa.py. For a baked badge image, verify_badge(data, '3', pubkey_pem=pub_pem, allow_pq=True) is the facade the CLI uses; for a config-driven issuer, issue_from_conf / issue_credential_from_conf pick the algorithm from the key file. The full list of functions that take allow_pq is in Python API OB3.

SD-JWT VC (the [eudi] extra):

from openbadgeslib.ob3.eudi import issue_badge_sd_jwt, verify_badge_sd_jwt

token = issue_badge_sd_jwt(credential, privkey_pem=priv_pem)    # alg: ML-DSA-65
result = verify_badge_sd_jwt(token, pubkey_pem=pub_pem, allow_pq=True)

Without allow_pq=True the verification raises EudiError, again before any crypto.

What is not implemented, and why

  • Data Integrity post-quantum cryptosuites (mldsa44-rdfc-2024 and the others). The W3C "Quantum-Resistant Cryptosuites v1.0" is a First Public Working Draft (16 June 2026) whose own status says "This specification is experimental, do not use it in any production setting", and it does not state the signing variant or context. proof_format = ldp stays Ed25519-only; an ML-DSA key with ldp is refused before anything is signed.
  • did:key / Multikey for ML-DSA. did:key requires base58btc and lists no post-quantum key type, and the multicodec ML-DSA code points are still status "draft". An ML-DSA key is published as an AKP publicKeyJwk in a did:web document, or wrapped in a did:jwk; did_key_from_pem raises ValueError for it.
  • SLH-DSA (the JOSE draft is not approved, and cryptography does not offer it), FN-DSA / Falcon, and composite / hybrid ML-DSA + ECDSA JOSE signatures (draft-ietf-jose-pq-composite-sigs is a working-group draft).
  • OpenBadges 1.0 and 2.0. RFC 9964 is a JOSE binding and the OB 1.0 / 2.0 JWS profiles list no such algorithm, so ML-DSA keys are refused there (signing, verifying, and openbadges-publish -V 1/-V 2).
  • OID4VCI wallet key proofs: they stay classical (ES256, ES384, EdDSA), so a wallet cannot bind a credential to an ML-DSA holder key through the credential endpoint.

SD-JWT VC: x5c, status lists and holder keys

Three more SD-JWT VC paths accept ML-DSA, each under the same opt-in and each relying on openvc-core 1.39.0 or newer (the floor of the [eudi] extra):

  • x5c: issue_badge_sd_jwt(..., x5c=[…]) accepts an ML-DSA issuer key with an ML-DSA certificate chain (RFC 9881). verify_badge_sd_jwt(token, x5c_trust_anchors=[…], allow_pq=True) validates it; without the flag an ML-DSA certificate anywhere in the chain is refused before path validation.
  • IETF Token Status List: status_list_token_resolver(pubkey_pem=…, allow_pq=True) verifies a status-list token signed with an ML-DSA key. Without the flag an ML-DSA key is refused when the resolver is built. The token's alg must be the key's own parameter set, and the flag widens nothing for a classical key. The token itself is built with openvc-core's build_status_list_token(..., allow_pq=True).
  • Holder binding: holder_jwk may be an RFC 9964 AKP public JWK (its alg is required and pub must have the parameter set's length), whatever the issuer key is. A Key-Binding JWT signed with ML-DSA is refused before any crypto unless the verifier passes allow_pq=True, and it must verify against an AKP cnf.jwk whose alg is the Key-Binding JWT's own. A classical JWK carrying an AKP pub member is refused.

Interoperability caveats

  • Open Badges 3.0 section 8.2.3: "The signing algorithm MUST be "RS256" as a minimum … Support for other algorithms is permitted but their use limits interoperability". Section 8 adds: "In order to pass 1EdTech conformance tests, issuers MUST use a proof mechanism supported by the 1EdTech conformance test suite", and the OB 3.0 Implementation Guide (section 3.1.2) names only EdDSA Data Integrity and RS256 JWT. So ML-DSA is permitted by section 8.2.3 but limits interoperability, it is outside the proof mechanisms the 1EdTech conformance test suite covers, and most verifiers will not accept it. Issuing one is a decision for an issuer whose recipients' verifiers are known.
  • HAIP 1.0 requires ES256 as a minimum.
  • EUDI ARF: the ARF restricts algorithms to the ECCG Agreed Cryptographic Mechanisms v2.0, which recommend ML-DSA combined with a classical mechanism and prefer ML-DSA-65 and ML-DSA-87. A standalone ML-DSA SD-JWT VC is therefore not EUDI-conformant, and this library does not produce the combined form. ETSI TS 119 312 V2.1.1 likewise recommends pure ML-DSA (not HashML-DSA) and hybrids.
  • Size: tokens and baked images grow by several KB (see the table above); check any limit your hosting, email or wallet imposes on a credential.
  • This page documents behaviour; it makes no claim of conformance or certification for any profile.

Standards

Related

Clone this wiki locally