Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use subjectDistinguishedName for openID4vp verifier, update packages #20

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading