From 10da47bdd1972d919a257c314b2838538cf6911d Mon Sep 17 00:00:00 2001 From: Filippos Sakellaropoulos Date: Tue, 6 Feb 2024 23:31:08 +0200 Subject: [PATCH] fix for verifier name --- Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VpService.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VpService.swift b/Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VpService.swift index 7ff2787..fd46275 100644 --- a/Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VpService.swift +++ b/Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VpService.swift @@ -138,7 +138,7 @@ public class OpenId4VpService: PresentationService { let chainVerifier = X509CertificateChainVerifier() let verified = try? chainVerifier.verifyCertificateChain(base64Certificates: certificates) var result = chainVerifier.isChainTrustResultSuccesful(verified ?? .failure) - guard let self, let b64cert = certificates.last, let data = Data(base64Encoded: b64cert), let str = String(data: data, encoding: .utf8) else { return result } + guard let self, let b64cert = certificates.first, let data = Data(base64Encoded: b64cert), let str = String(data: data, encoding: .utf8) else { return result } guard let encodedData = Data(base64Encoded: str.removeCertificateDelimiters()), let cert = SecCertificateCreateWithData(nil, encodedData as CFData) else { return result } var cfName: CFString?; SecCertificateCopyCommonName(cert, &cfName); self.readerCertificateIssuer = cfName as String? let (isValid, reason, _) = SecurityHelpers.isValidMdlPublicKey(secCert: cert, usage: .mdocAuth, rootCerts: self.iaca)