Reputation: 11
I am reading the German e-Passport and it's reading the Datagroups 1,2,3 & 14 and SOD, COM also. Now, I want to read the Datagroup 11 which hold the additional details. But the German Passport doesn't read the optional data. So, how do I know Which passports read which Groups? I have gone through the ICAO 9303 but didn't get any chance to get this information.
Upvotes: 1
Views: 1946
Reputation: 61
You cannot read the DG11 from german ePassport, because it does not contain DG11. You can see which Datagroups are contained by looking at the EF.COM or EF.SOD file. EF.COM is like the passport's table of contents. But it is not signed, so cannot be trusted. But EF.SOD is signed and can be trusted. Since it contains hashes for all Datagroups, you can just check this file, for which Datagroups it contains a hash. If there is no hash for DG11, then the Passport does not contain DG11. Of course, you can only trust EF.SOD if you performed Passive Authentication (Ef.SOD's is signed by DS certificate which is signed by CSCA certificate)
Upvotes: 0
Reputation: 2204
In my app I read DG32, DG33, DG34, but flow is the same, here is some example of how to implement DG11 file reading using NFCPassportReader
public class DataGroup {
public var elements: [String: String] = [:]
// I added this dictionary to get value by key from documentation
class DG11: DataGroup {
private let tags = [0x5F0E, 0x5F0F, 0x5F10, 0x5F11, 0x5F2B]
required init(_ data: [UInt8]) throws {
try super.init(data)
datagroupType = .DG11
}
override func parse(_ data: [UInt8]) throws {
var tag = try getNextTag()
if tag != 0x5C { throw TagError.InvalidResponse }
_ = try getNextValue()
try tags.forEach { _ in
tag = try getNextTag()
parseBody(try getNextValue(), key: String(tag, radix: 16, uppercase: true))
}
print(elements)
}
private func parseBody(_ data: [UInt8], key: String) {
elements[key] = String(bytes: data[0...], encoding: .utf8)
}
}
Hope it helps
Upvotes: 0