From 889a3ab4fc1cfab8d1955418b2a5bd6fd9f8c77b Mon Sep 17 00:00:00 2001 From: kenkosmowski Date: Mon, 19 May 2025 14:35:41 +0200 Subject: [PATCH] enforce doctype match for mdoc pex Signed-off-by: kenkosmowski --- .../Oid4Vp/PresentationExchange/Services/PexService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WalletFramework.Oid4Vc/Oid4Vp/PresentationExchange/Services/PexService.cs b/src/WalletFramework.Oid4Vc/Oid4Vp/PresentationExchange/Services/PexService.cs index 983740a6..0c5f4e53 100644 --- a/src/WalletFramework.Oid4Vc/Oid4Vp/PresentationExchange/Services/PexService.cs +++ b/src/WalletFramework.Oid4Vc/Oid4Vp/PresentationExchange/Services/PexService.cs @@ -170,7 +170,8 @@ private async Task>> GetMatchingCredentials( var filteredMdocRecords = mdocRecords.OnSome(records => records .Where(record => { - return record.Mdoc.IssuerSigned.IssuerAuth.ProtectedHeaders.Value.TryGetValue(new CoseLabel(1), out var alg) + return record.DocType == inputDescriptor.Id + && record.Mdoc.IssuerSigned.IssuerAuth.ProtectedHeaders.Value.TryGetValue(new CoseLabel(1), out var alg) && supportedFormatSigningAlgorithms.Match( formats => formats.MDocFormat?.Alg?.Contains(alg.ToString()) ?? true, () => inputDescriptor.Formats?.MDocFormat?.Alg?.Contains(alg.ToString()) ?? true)