Egov.Extensions.WalletValidation 10.0.11

Prefix Reserved
dotnet add package Egov.Extensions.WalletValidation --version 10.0.11
                    
NuGet\Install-Package Egov.Extensions.WalletValidation -Version 10.0.11
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Egov.Extensions.WalletValidation" Version="10.0.11" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Egov.Extensions.WalletValidation" Version="10.0.11" />
                    
Directory.Packages.props
<PackageReference Include="Egov.Extensions.WalletValidation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Egov.Extensions.WalletValidation --version 10.0.11
                    
#r "nuget: Egov.Extensions.WalletValidation, 10.0.11"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Egov.Extensions.WalletValidation@10.0.11
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Egov.Extensions.WalletValidation&version=10.0.11
                    
Install as a Cake Addin
#tool nuget:?package=Egov.Extensions.WalletValidation&version=10.0.11
                    
Install as a Cake Tool

Wallet Validation

A reusable .NET library for creating OpenID4VP mdoc authorization requests and validating encrypted wallet presentations. X.509 trust and revocation checks are provided by Egov.Extensions.CertificateValidation through NuGet and certificate loading provided by Egov.Extensions.Configuration.

Prerequisites and installation

.NET 10.0 and the ASP.NET Core shared framework are required. The verifier needs an ECDSA P-256 certificate with a private key, and trusted issuer/status-list root certificates.

dotnet add package Egov.Extensions.WalletValidation

Configuration

The validator accepts only the credential types you register, and each type (or group of types) gets its own certificate policy: its own trusted roots for issuer (document signer) certificates and for status-list tokens. A document is accepted only if its issuer chains to the roots of its own doctype's policy, so an mDL authority cannot issue a PID that would be accepted. Requests and responses for a doctype with no registered policy are rejected.

Register the validator in Program.cs and add the accepted doctypes on the returned builder:

using Microsoft.Extensions.DependencyInjection;

builder.Services.AddWalletValidator(options =>
    {
        options.CertificatePath = "Files/Certificates/verifier.pfx";
    })
    .AddDocumentTypes(["org.iso.18013.5.1.mDL"], policy => policy
        .ValidateIso18013DocumentSigner()
        .ConfigureIssuer(o => o.CustomTrustPaths = ["Files/Certificates/Trust/Iaca"]))
    .AddDocumentTypes(["eu.europa.ec.eudi.pid.1", "eu.europa.ec.eudi.pid.1.ext"], policy => policy
        .ConfigureIssuer(o =>
        {
            o.CustomTrustPaths = ["Files/Certificates/Trust/Pid"];
            o.QualifiedCertificate = new() { QcType = "0.4.0.194126.1.1" };
        })
        .ConfigureStatusList(o => o.CustomTrustPaths = ["Files/Certificates/Trust/PidStatus"]));

AddDocumentType("org.iso.18013.5.1.mDL", ...) is shorthand for a single doctype.

Or bind everything from configuration. Supply certificate passwords through your application's secret configuration provider.

builder.Services.AddWalletValidator(builder.Configuration.GetSection("WalletValidation"));
{
  "WalletValidation": {
    "CertificatePath": "Files/Certificates/verifier.pfx",
    "StatusValidationMode": "Online",
    "StatusMaxAge": "1.00:00:00",
    "StatusValidationClockSkew": "00:00:15",
    "RegistrationCertificates": {
      "age-check": { "RegistrationCertificatePath": "Files/Certificates/Registration/age-check.txt" }
    },
    "CredentialTypes": [
      {
        "DocTypes": [ "org.iso.18013.5.1.mDL" ],
        "ValidateIso18013DocumentSigner": true,
        "Issuer": { "CustomTrustPaths": [ "Files/Certificates/Trust/Iaca" ] }
      },
      {
        "DocTypes": [ "eu.europa.ec.eudi.pid.1", "eu.europa.ec.eudi.pid.1.ext" ],
        "Issuer": {
          "CustomTrustPaths": [ "Files/Certificates/Trust/Pid" ],
          "QualifiedCertificate": { "QcType": "0.4.0.194126.1.1" }
        },
        "StatusList": { "CustomTrustPaths": [ "Files/Certificates/Trust/PidStatus" ] }
      }
    ]
  }
}

Each CredentialTypes entry is one policy. DocTypes is required; ValidateIso18013DocumentSigner and RequireStatus (see Validating a response) default to false; Issuer and StatusList are bound as CertificateValidationOptions with ConfigureIssuer(IConfiguration) and ConfigureStatusList(IConfiguration). A present StatusList section is an explicit status-list policy; without it the status-list policy is derived. More doctypes can be added on the builder returned by the configuration overload, in code or with AddDocumentTypes(IConfiguration), which reads an array of the same entries from any section (for example .AddDocumentTypes(builder.Configuration.GetSection("MoreCredentialTypes"))). Values bound from configuration are applied on top of the defaults below: scalar values replace them, but list values (for example MandatoryExtensions or ApplicationPolicy) are added to the default lists. To replace a default list, use the Action<CertificateValidationOptions> overloads of ConfigureIssuer or ConfigureStatusList in code.

ConfigureIssuer and ConfigureStatusList both have an Action<CertificateValidationOptions> and an IConfiguration overload, like AddWalletValidator, and can be mixed: calls apply in order. For example, to keep doctypes in code and certificate policies in configuration:

builder.Services.AddWalletValidator(builder.Configuration.GetSection("WalletValidation"))
    .AddDocumentType("org.iso.18013.5.1.mDL", policy => policy
        .ValidateIso18013DocumentSigner()
        .ConfigureIssuer(builder.Configuration.GetSection("MdlIssuer"))
        .ConfigureStatusList(builder.Configuration.GetSection("MdlStatusList")));

Registration includes logging, a default TimeProvider, HTTP clients, a distributed memory cache, WalletValidator and IStatusListChecker. Resolve WalletValidator from these services; its constructor is not public. An existing TimeProvider, IDistributedCache or IStatusListChecker registration is preserved. Register a shared distributed cache first when running multiple application instances.

Options reference

Option Default Purpose
CertificatePath Unset PFX/PKCS#12 file or directory containing tls.crt and tls.key.
CertificatePassword Unset Password for the certificate/private key, if encrypted.
Certificate Unset Code-only alternative: a verifier certificate with its private key.
IntermediateCertificates Unset Code-only intermediate chain for the request's x5c; populated when loaded from a chain bundle.
RegistrationCertificates Empty Registration certificates keyed by intended use, each with RegistrationCertificatePath (a file with the encoded certificate) or RegistrationCertificate (the encoded certificate itself). See Registration certificates.
StatusValidationMode Online Credential status checking: Online or NoCheck.
StatusMaxAge 24 hours Maximum status list token age, counted from its issued-at claim. Older tokens are rejected even without or before their expiration, so an old list cannot be replayed.
StatusValidationClockSkew 15 seconds Tolerance for issued-at and not-before claims. Expiration remains strict.
DeviceEngagementUrlFormat eudi-openid4vp://?client_id={0}&request_uri={1}&request_uri_method=post URL format with escaped client ID and request URI placeholders.

Trusted roots, revocation mode and qualified-certificate statements are set per policy with CertificateValidationOptions from Egov.Extensions.CertificateValidation (for example CustomTrustPaths, CustomTrustStore, RevocationMode and QualifiedCertificate, whose RequireQcCompliance defaults to true).

Post-configuration loads the verifier certificate through Egov.Extensions.Configuration and rejects a missing certificate or one without a private key. It also reads each RegistrationCertificatePath whose RegistrationCertificate is not set, and rejects a missing registration certificate or certificate file. Request signing requires ECDSA P-256. WalletValidatorOptions.Dispose() disposes its verifier and intermediate certificates, including directly assigned certificates; coordinate ownership if sharing them.

Certificate policies

Each policy registers two named CertificateValidationOptions and matching keyed ICertificateValidator services. Their key is the policy's doctypes joined with commas, with a comma or backslash inside a doctype escaped by a backslash so that different policies never share a key: WalletIssuer:{key} and WalletStatusList:{key}, for example WalletIssuer:eu.europa.ec.eudi.pid.1,eu.europa.ec.eudi.pid.1.ext.

Policies are fixed at registration. Configuration sections passed to ConfigureIssuer, ConfigureStatusList or AddDocumentTypes, including the CredentialTypes array of AddWalletValidator, are read once, when they are registered; later changes and reloads are not applied, so restart the application to change trusted roots or doctypes. This prevents an edit that reorders CredentialTypes entries from giving one doctype another entry's trusted roots.

The issuer policy is built in this order:

  1. Baseline: custom root trust only (TrustMode = CustomRootTrust; system roots are never used), certificate downloads off (EnableCertificateDownloads = false), a DigitalSignature leaf, ECDSA keys on P-256, P-384 or P-521 with SHA-256/384/512 signatures, forbidden Name Constraints, Policy Mappings, Policy Constraints, Freshest CRL and Inhibit anyPolicy extensions, and an ECDSA issuing CA directly below the root (path length constraint 0).
  2. ISO/IEC 18013-5 document signer profile, off unless you enable it with ValidateIso18013DocumentSigner() or "ValidateIso18013DocumentSigner": true: the leaf EKU must explicitly contain mdlDS (1.0.18013.5.1.2; an absent EKU or anyExtendedKeyUsage alone fails), validity of at most 457 days, a CRL Distribution Points extension, and a leaf country matching the root country (when the root has a state or province, the leaf must have the same one). Enable it for credentials whose signers follow ISO/IEC 18013-5, such as the mDL. It applies to mdoc doctypes only.
  3. Your configuration: ConfigureIssuer (with an action or a configuration section), or the Issuer entry of CredentialTypes. It runs last, so it can override the defaults.

Every status-list policy starts from the baseline. With the ISO profile enabled, it also limits the signer to at most 457 days validity (MaxValidity; configuration can change it); without the profile, status-list signer validity is not limited. By default the policy is derived from the issuer policy: the ISO profile (when enabled) and your issuer configuration run again under the status-list name, and the qualified-certificate statements are then removed. A derived policy therefore has the issuer's trust anchors, revocation mode and EKU requirement and, with the ISO profile, its validity limit, required CRL Distribution Points extension and country check: with ValidateIso18013DocumentSigner(), status lists must be signed by a certificate with the mdlDS EKU, so not every digital-signature certificate under the issuer's roots can sign them. Settings made with services.Configure<CertificateValidationOptions>("WalletIssuer:{key}", ...) outside the builder apply to the issuer policy only. Because ConfigureIssuer actions also run for the derived policy, create new collections inside them (o.CustomTrustStore = [root]) rather than assigning a shared instance. A status-list-specific EKU is not required yet, as none has been assigned; until then a derived policy uses the issuer's. Call ConfigureStatusList, or add a StatusList section, to replace the derivation with an explicit policy that starts from the baseline only, plus the 457-day limit when the ISO profile is enabled (not the rest of the profile), and needs its own trusted roots.

Every issuer policy must also restrict which certificates under its roots may sign credentials, so that a TLS, status-list or other certificate issued by the same root cannot sign an MSO. It needs one of:

  • an EKU that must be explicitly present: ValidateIso18013DocumentSigner() (mdlDS), or ApplicationPolicy together with RequireExplicitApplicationPolicy = true (without it, a certificate with no EKU or with anyExtendedKeyUsage also matches);
  • required qualified certificate statements: QualifiedCertificate with its QcType, for example 0.4.0.194126.1.1 as in the PID sample above.

Neither identifies the signer. A dedicated root, such as an IACA, issues only that issuer's signers, but a qualified trust service provider's CA issues qualified seals to many organizations: under such a root, a policy requiring only a QcType accepts every one of them. Pin the issuer's identity as well, for example with AllowedCommonNames, AllowedThumbprints, a certificate policy (CertificatePolicy with RequireExplicitCertificatePolicy) or a CustomValidation check of the organizationIdentifier. Status-list policies are not subject to this check.

Startup fails when a doctype is registered in two policies, a policy has no doctypes, a policy has no trusted roots (neither CustomTrustPaths nor CustomTrustStore is set, or TrustMode was changed from CustomRootTrust), or an issuer policy requires neither an explicit EKU nor qualified certificate statements. The trust and issuer checks run through options validation with ValidateOnStart, so a host stops at startup; without a host, the error is thrown when the policy is first used.

Certificate downloads (AIA) stay off unless a policy sets EnableCertificateDownloads = true. Chains are built from the certificates the presentation carries plus ExtraPaths/ExtraStore; add intermediate certificates there instead of enabling downloads.

Creating a request

Inject WalletValidator. Use the wallet metadata and nonce received when the wallet retrieves your authorization request. Build a DCQL query for the required claims:

using Egov.Extensions.WalletValidation;
using Egov.Extensions.WalletValidation.OpenId4Vp;

const string queryId = "pid";
const string docType = "eu.europa.ec.eudi.pid.1";

var query = new DcqlQuery
{
    Credentials = [new CredentialQuery
    {
        Id = queryId,
        Format = "mso_mdoc",
        Meta = new CredentialQueryMeta { DocTypeValue = docType },
        Claims = [new CredentialQueryClaim { Path = [docType, "family_name"] }]
    }]
};

var request = validator.CreateMdocRequest(
    walletMetadata, walletNonce, transactionId, query, responseUri,
    state: expectedState);

// Return request.AuthorizationRequestJws to the wallet.
// Retain request.Nonce and request.EphemeralKey server-side for this transaction,
// and retain the query too, or be able to rebuild an equivalent one for validation.

Every credential query must use the mso_mdoc format with a meta.doctype_value, and every claim path must be [namespace, element identifier]; otherwise CreateMdocRequest throws ArgumentException. See DCQL rules.

The request is signed with ES256 and contains the verifier's x5c chain, an x509_hash: client ID, a fresh 128-bit nonce and a public P-256 response encryption key whose kid is the transaction ID. It requests direct_post.jwt responses encrypted with ECDH-ES and A256GCM, and advertises ES256, ES384 and ES512 (COSE -7, -35, -36) for mdoc issuer and device signatures; responses signed with any other algorithm are rejected. The signing key must be on the algorithm's curve: P-256 for ES256, P-384 for ES384 and P-521 for ES512 (UNSUPPORTED_CERTIFICATE_KEY for the issuer certificate, UNSUPPORTED_DEVICE_KEY for the device key). An optional intendedUse selects the registration certificate (see Registration certificates), and optional transactionData is supported (see Transaction data).

To build the wallet engagement URL, inject IOptions<WalletValidatorOptions> and use options.Value.BuildDeviceEngagementUrl(requestUri).

Registration certificates

A wallet-relying party registration certificate (ETSI TS 119 475) tells the wallet who the verifier is, why it asks and which attestations and attributes it registered to request. A relying party receives a separate certificate for each combination of Service and intended use (EUDI ARF RPRC_09), and every request carries exactly one: the one for its intended use. Under Implementing Regulation (EU) 2026/1731, which applies ETSI TS 119 472-2 V1.2.1 to OpenID4VP presentations, the request's verifier_info must include it. Wallets warn the user when a request has no valid certificate, or asks for more than the certificate registers.

Configure the certificates in RegistrationCertificates, keyed by a name for each intended use, either from files (shown in the configuration sample above) or in code. Each value must already be in the form the wallet expects in data: the base64url encoding of the serialized certificate (OIDFVP-HAIP-COMMON-REQ-RO-16).

builder.Services.AddWalletValidator(options =>
{
    options.CertificatePath = "Files/Certificates/verifier.pfx";
    options.RegistrationCertificates["age-check"] = new() { RegistrationCertificatePath = "Files/Certificates/Registration/age-check.txt" };
    options.RegistrationCertificates["onboarding"] = new() { RegistrationCertificate = onboardingCertificate };
});

Pass the intended use when creating the request:

var request = validator.CreateMdocRequest(walletMetadata, walletNonce, transactionId, query,
    responseUri, intendedUse: "onboarding");

The request then has "verifier_info": [{ "format": "registration_cert", "data": "..." }], where data is the configured value (OIDFVP-HAIP-COMMON-REQ-RO-14 to RO-16). intendedUse can be omitted when exactly one certificate is configured. With none configured, the request has no verifier_info. CreateMdocRequest throws ArgumentException for an intended use with no certificate, or when it is omitted while several are configured. Keys are case-sensitive.

Every certificate must belong to the Service identified by the verifier certificate: wallets require the same relying party identifier and Service identifier in both. A Service with its own access certificate needs its own validator configuration. Certificates are sent as configured, trimmed of surrounding whitespace: their encoding, form (typ rc-wrp+jwt or rc-wrp+cwt), signature, expiry and contents are not checked, so replace certificates before they expire (at most 12 months after issuance) and restart the application to load new ones.

Validating a response

Read the wallet's encrypted response form field at your response endpoint, retrieve or rebuild the DCQL query sent in the request (for example from your own configuration, or deserialized from persisted JSON), restore the original transaction data, and call:

using Egov.Extensions.WalletValidation.Mdoc;

var result = await validator.VerifyMdocResponseAsync(
    authorizationResponseJwe,
    transactionId,
    query,
    responseUri,
    nonce: request.Nonce,
    ephemeralKey: request.EphemeralKey,
    cancellationToken: cancellationToken);

if (result.IsWalletError)
{
    // For example, access_denied means the user declined to share a document.
    // Check result.State against retained application state when applicable.
    logger.LogInformation("Wallet reported {Error}: {Description}", result.Error, result.ErrorDescription);
    return;
}

if (!result.IsValid)
{
    logger.LogWarning("Wallet rejected: {Code}: {Message}", result.Error, result.ErrorDescription);
    return;
}

// Credentials are keyed by DCQL query id, in vp_token order; each list holds one
// presentation, or several when the credential query sets multiple.
var pid = (MdocPresentedCredential)result.Credentials[queryId][0];
var document = pid.Document; // pid.DocType, pid.QueryId and pid.TransactionData are also available
var returnedState = result.State;

The validator checks response nonce/key binding and decrypts the JWE, then checks the vp_token against the whole DCQL query (see DCQL rules). For every presentation it parses the mdoc, verifies issuer-signed value digests and MSO validity, authenticates issuer and device signatures, checks the returned claims and values, and validates the issuer certificate. It then verifies transaction data bindings and, when enabled, checks the status of every credential whose MSO.status is present, one at a time in presentation order. An absent status is accepted, unless the document's policy requires one with RequireStatus() (or "RequireStatus": true in a CredentialTypes entry): then the credential fails with MISSING_STATUS, as it could never be revoked. NoCheck skips this check too. A present status must contain a complete, valid status-list reference. Issuer-certificate revocation checks still follow the configured certificate policy.

Validation is all-or-nothing: any failure in any presentation rejects the whole response with IsValid = false, a machine-readable Error and an optional ErrorDescription, and Credentials is null. Errors about one presentation start their description with Credential '<query id>': . Caller cancellation during status retrieval propagates as cancellation.

Encrypted wallet errors return IsValid = false and IsWalletError = true, with the wallet's original Error, optional ErrorDescription and State. They are recognized only after authenticated decryption with the retained transaction key; the JWE apu, apv and kid headers are not required for them. Decryption does not prove who sent the error: anyone who obtained the request can encrypt to its public key, so treat wallet errors as untrusted (for example, do not render ErrorDescription unescaped).

Malformed presentations are reported as validation failures, never as exceptions; anything unexpected while validating a presentation is reported as INVALID_PRESENTATION.

The application owns transaction storage, expiry, single-use/replay prevention, state comparison and authorization based on returned claims. The validator enforces the DCQL query that was sent, so pass the retained query or an equivalent rebuilt one; business rules on the claim values remain the application's. Keep the ephemeral private key server-side and erase it when the transaction is consumed or expires.

DCQL rules

VerifyMdocResponseAsync supports queries whose credential queries all use mso_mdoc with a meta.doctype_value and two-element claim paths. Any other query fails with UNSUPPORTED_CREDENTIAL_QUERY (wallet errors are still returned first). A query for a doctype with no registered certificate policy fails with UNTRUSTED_DOCUMENT_TYPE before any presentation is parsed, and CreateMdocRequest throws ArgumentException for it.

  • Credentials. Every vp_token key must be a credential query id from the query (UNEXPECTED_QUERY_ID). Without credential_sets, every credential query must be answered (MISSING_CREDENTIAL). With credential_sets, every set with required: true (the default) needs at least one option whose ids were all returned (CREDENTIAL_SET_NOT_SATISFIED); credentials that appear only in non-required sets may be absent.
  • multiple. Each vp_token entry must hold exactly one presentation, or one or more when the credential query sets multiple: true (INVALID_CREDENTIALS_COUNT).
  • Distinct credentials. A credential may be presented only once per response, under one query id: two presentations carrying the same issuer-signed Mobile Security Object fail with DUPLICATE_CREDENTIAL, even when each has its own device signature. Separately issued copies of a credential have different MSOs and are not detected; apply claim-level rules for those.
  • One document per presentation. Each presentation's DeviceResponse must contain exactly one document (NO_DOCUMENTS, INVALID_DOCUMENTS_COUNT) of the queried doc type (DOCUMENT_TYPE_MISMATCH).
  • Claims. A claim is an issuer-signed element, with path [namespace, element identifier]. An element returned twice fails with UNREQUESTED_CLAIM. Without claims, the wallet may return any issuer-signed elements. With claims, an element that was not requested fails with UNREQUESTED_CLAIM. With claims and no claim_sets, every requested claim must be returned (MISSING_CLAIM). With claim_sets, the claims referenced by them need an id, at least one option must be fully returned (CLAIM_SET_NOT_SATISFIED), and only claims listed in some option may be returned. Device-signed elements are not claims; they are governed by the MSO key authorizations.
  • values. When a returned claim's query lists values, its CBOR value must equal one of them (CLAIM_VALUE_MISMATCH). Text strings, integers and booleans are supported; values may be .NET primitives or JsonElements, for example from a query deserialized from persisted JSON. Other CBOR types with values fail with CLAIM_VALUE_MISMATCH.
  • trusted_authorities is sent to the wallet but is not enforced yet. Issuer trust comes from the trusted roots and issuer certificate policy registered for the document's doctype; an issuer certificate that fails it is reported as ISSUER_CERTIFICATE_INVALID.

Transaction data

Requests can carry OpenID4VP transaction_data (for example a payment or a signature authorization) that the wallet must bind to the presentation. Define each transaction data type by deriving from MdocTransactionData, which derives from the format-independent TransactionData: declare its type-specific properties, check them in Validate, and verify the mdoc binding in VerifyBinding. OpenID4VP appendix B.2.1 leaves the mdoc binding to each type, recommending a data element the type defines, returned in DeviceSigned and authorized by the issuer in the MSO key authorizations:

public sealed class PaymentTransactionData() : MdocTransactionData("https://verifier.example/payment")
{
    [JsonPropertyName("amount"), JsonPropertyOrder(1)] public required string Amount { get; init; }
    [JsonPropertyName("currency"), JsonPropertyOrder(2)] public required string Currency { get; init; }

    public override void Validate()
    {
        base.Validate(); // credential_ids
        if (Currency is not { Length: 3 }) throw new FormatException("currency must be a 3-letter code");
    }

    public override TransactionDataValidationResult VerifyBinding(MdocTransactionDataValidationContext context)
    {
        if (!context.DeviceNameSpaces.DeviceSignedItems.TryGetValue("eu.example.payment", out var items) ||
            !items.TryGetValue("payment_confirmation", out var value))
            return TransactionDataValidationResult.Missing("Payment confirmation missing");
        // Decode the CBOR value and compare it with Amount and Currency.
        return matches ? TransactionDataValidationResult.Valid()
            : TransactionDataValidationResult.Mismatch();
    }
}

Give every serialized property a [JsonPropertyName] with the exact field name the type's specification defines, and a [JsonPropertyOrder] from 1 upwards. type and credential_ids use -2 and -1, so they are always written first. Without explicit order, System.Text.Json writes a derived class's own properties before the inherited ones, and the order can change when the class is refactored. A fixed order makes Encode produce the same string for the same values.

Pass instances to the request. request.TransactionData contains the base64url entries exactly as sent. Persist them unchanged: rebuild typed objects from them with TransactionData.Decode<T>, or, for a binding defined by hashes (such as SD-JWT VC transaction_data_hashes), hash each stored string's ASCII bytes directly, without decoding it. Re-encoding a rebuilt object can change its bytes, so the hash would no longer match.

var request = validator.CreateMdocRequest(walletMetadata, walletNonce, transactionId, query,
    responseUri, transactionData: [new PaymentTransactionData
    {
        CredentialIds = [queryId], Amount = "10.00", Currency = "EUR"
    }]);

To validate the response, rebuild the instances, either from your own records or from the persisted entries with TransactionData.Decode<T>, and pass them as transactionData:

var result = await validator.VerifyMdocResponseAsync(authorizationResponseJwe, transactionId,
    query, responseUri, nonce: request.Nonce, ephemeralKey: request.EphemeralKey,
    transactionData: [TransactionData.Decode<PaymentTransactionData>(persistedEntry)],
    cancellationToken: cancellationToken);
// On success, each PresentedCredential.TransactionData lists the entries bound to that presentation.

CreateMdocRequest throws ArgumentException for entries that fail Validate or reference credential IDs missing from the DCQL query. On the response, every entry must pass Validate (otherwise INVALID_TRANSACTION_DATA). At least one returned presentation must belong to a query id in its credential_ids (otherwise TRANSACTION_DATA_NOT_PRESENTED), so an entry may name an optional credential the wallet did not return as long as another listed credential was returned. VerifyBinding is then called for every returned presentation whose query id is in credential_ids, and each must verify: a failure code is returned unchanged, and an exception is reported as INVALID_TRANSACTION_DATA_BINDING. VerifyBinding runs only after the device signature, which covers the device-signed namespaces, and the key authorizations have been verified, so an element the issuer did not authorize fails with DEVICE_KEY_UNAUTHORIZED. Each verified entry is recorded in that presentation's PresentedCredential.TransactionData. Nothing is checked when transactionData is null.

Status lists and supported formats

WalletValidator checks each document's status with the status-list validator of the document's own policy, so a status list is trusted only if its signer chains to that policy's status-list roots. IStatusListChecker.CheckAsync(uri, index, certificateValidator, cacheScope, maxAge, clockSkew, cancellationToken) also works independently: pass the ICertificateValidator for the token's signing certificate and a cache scope naming that trust policy. It accepts signed JWT (statuslist+jwt with x5c) and COSE/CWT (application/statuslist+cwt with x5chain) responses signed with ES256, ES384 or ES512. For both, the certificate curve must match the algorithm (P-256, P-384 and P-521 respectively). It validates signatures, certificate trust, subject, time claims and positive TTL when provided. Lists may use 1, 2, 4 or 8 bits per entry; zero is valid and any nonzero status is invalid. StatusCheckResult.IsSuccessful distinguishes retrieval/validation failure from a successful check of an invalid credential; IsValid holds the status outcome.

Validated lists are cached until token expiry, with refresh governed by TTL or a default interval. Without exp, expiry defaults to six hours and refresh to one hour. On a failed HTTP refresh, an unexpired validated list may be reused. Cache entries separate cache scopes (the policy key, for WalletValidator), URIs, maximum ages and clock-skew values, so a list validated under one policy is never reused under another. Invalid tokens are never cached.

Status lists are retrieved over https only: a URI that is not an absolute https URI fails the check before any request or cache lookup. For documents, this is reported as DOCUMENT_STATUS_CHECK_FAILED. Redirects are left to the HTTP handler; the built-in handlers never follow an https-to-http redirect.

Retrieval is limited to StatusListChecker.DefaultRequestTimeout (60 seconds) and token responses to StatusListChecker.MaxTokenSize (16 MiB, enforced while reading, with or without Content-Length). Decompressed lists are limited to StatusList.MaxListSize (16 MiB).

Presentation validation handles mdoc version 1.0 with ECDSA issuer/device signatures. It does not validate SD-JWT VC presentations, device MAC authentication, or DCQL trusted_authorities. Serialization models expose additional wire fields for integration; their availability does not imply validation of every format.

Building, testing and packaging

dotnet restore src/Egov.Extensions.WalletValidation.slnx
dotnet build src/Egov.Extensions.WalletValidation.slnx --configuration Release --no-restore
dotnet test src/Egov.Extensions.WalletValidation.slnx --configuration Release --no-build
dotnet pack src/Egov.Extensions.WalletValidation/Egov.Extensions.WalletValidation.csproj --configuration Release --output artifacts /p:Version=10.0.5

Tests generate disposable certificates and signed JWT/COSE/JWE payloads, use a controllable clock and HTTP fixtures, and require no live wallet, production keys or network services.

The workflow starts explicitly through Run workflow, builds and tests the solution, and publishes from main to NuGet.org and GitHub Packages after validation. CI assigns 10.0.<run_number> and passes it to build and pack. For local packaging, supply the desired version with /p:Version, as shown above. Configure the repository's NUGET_API_KEY secret before publishing; GitHub Packages uses the workflow token with packages: write.

Contributing and license

See CHANGELOG.md, CONTRIBUTING.md and CODE_OF_CONDUCT.md. Licensed under MIT; see LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.11 0 11/27/2026
10.0.10 83 11/24/2026
10.0.9 94 11/24/2026
10.0.8 96 11/23/2026
10.0.7 106 11/19/2026
10.0.6 91 11/19/2026
10.0.5 210 10/9/2026
10.0.4 141 10/7/2026