Skip to content

Commit

Permalink
Merge pull request #20 from eu-digital-identity-wallet/develop
Browse files Browse the repository at this point in the history
use subjectDistinguishedName for openID4vp verifier, update packages
  • Loading branch information
psima authored Feb 6, 2024
2 parents e35d98b + 2ad03d4 commit 24b817f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-iso18013-data-transfer.git",
"state" : {
"revision" : "268ef13b1bbe58a14b966b6ad336adddddda657a",
"version" : "0.1.9"
"revision" : "332031d65fdf15bd7d2938849891a756fd6dccec",
"version" : "0.2.0"
}
},
{
"identity" : "eudi-lib-ios-iso18013-security",
"kind" : "remoteSourceControl",
"location" : "https://github.com/eu-digital-identity-wallet/eudi-lib-ios-iso18013-security.git",
"state" : {
"revision" : "4c8b26fbdbcf8c6110a0e12ba49c59c8158a1b12",
"version" : "0.1.7"
"revision" : "c0d935b3919f8e7a383f6b60b4b592abf6afd689",
"version" : "0.1.8"
}
},
{
Expand Down
11 changes: 4 additions & 7 deletions Sources/eudi-lib-ios-wallet-kit/Services/OpenId4VpService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ import MdocDataTransfer18013
import SiopOpenID4VP
import JOSESwift
import Logging
#if canImport(UIKit)
import UIKit
import SafariServices
#endif
import ASN1Decoder
/// Implements remote attestation presentation to online verifier

/// Implementation is based on the OpenID4VP – Draft 18 specification
Expand Down Expand Up @@ -82,7 +79,7 @@ public class OpenId4VpService: PresentationService {
var result: [String: Any] = [UserRequestKeys.valid_items_requested.rawValue: items]
if let readerCertificateIssuer {
result[UserRequestKeys.reader_auth_validated.rawValue] = readerAuthValidated
result[UserRequestKeys.reader_certificate_issuer.rawValue] = readerCertificateIssuer
result[UserRequestKeys.reader_certificate_issuer.rawValue] = MdocHelpers.getCN(from: readerCertificateIssuer)
result[UserRequestKeys.reader_certificate_validation_message.rawValue] = readerCertificateValidationMessage
}
return result
Expand Down Expand Up @@ -139,8 +136,8 @@ public class OpenId4VpService: PresentationService {
let verified = try? chainVerifier.verifyCertificateChain(base64Certificates: certificates)
var result = chainVerifier.isChainTrustResultSuccesful(verified ?? .failure)
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?
guard let certData = Data(base64Encoded: str.removeCertificateDelimiters()), let cert = SecCertificateCreateWithData(nil, certData as CFData), let x509 = try? X509Certificate(der: certData) else { return result }
self.readerCertificateIssuer = x509.subjectDistinguishedName
let (isValid, reason, _) = SecurityHelpers.isValidMdlPublicKey(secCert: cert, usage: .mdocAuth, rootCerts: self.iaca)
self.readerAuthValidated = isValid
self.readerCertificateValidationMessage = reason
Expand Down

0 comments on commit 24b817f

Please sign in to comment.