Hello, I have read your guide UG10045 and I have successfully integrated the Taplink iOS SDK in a demo Project.
In section 6.1 you describe an authenticationFlow with EV2 Card.
I have to use EV3 Cards, so I replicated that flow using a DesEV3Instance
Here my code:
private func authenticateWithCustomOrZero(_ desfire: TL_DESFireEV3, completion: @escaping (Bool, Bool) -> Void) {
desfire.authenticate(withCardKeyNo: 0, withAuthenticationType: .native, withAuthKeyType: .THREEDES, withCommandSetForAuth: .Native, withAuthkey: threeDESZero) { firstAuth3D in
os_log("Internal Log - %{public}@", log: OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "DemoLog"), type: .error, "firstAuth3D: \(firstAuth3D)")
desfire.changeKey(withCardKeyNo: 0, withAuthKeyType: .AES128, withFromKey: threeDESZero, withToKey: aesZero) { firstChangeAES in
os_log("Internal Log - %{public}@", log: OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "DemoLog"), type: .error, "firstChangeAES: \(firstChangeAES)")
desfire.authenticate(withCardKeyNo: 0, withAuthenticationType: .AES, withAuthKeyType: .AES128, withCommandSetForAuth: .Native, withAuthkey: aesZero) { firstAuthAES in
os_log("Internal Log - %{public}@", log: OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "DemoLog"), type: .error, "firstAuthAES: \(firstAuthAES)")
desfire.changeKey(withCardKeyNo: 0, withAuthKeyType: .THREEDES, withFromKey: aesZero, withToKey: threeDESZero) { lastChange3D in
os_log("Internal Log - %{public}@", log: OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "DemoLog"), type: .error, "lastChange3D: \(lastChange3D)")
desfire.authenticate(withCardKeyNo: 0, withAuthenticationType: .native, withAuthKeyType: .THREEDES, withCommandSetForAuth: .Native, withAuthkey: threeDESZero) { lastAuth3D in
os_log("Internal Log - %{public}@", log: OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "DemoLog"), type: .error, "lastAuth3D: \(lastAuth3D)")
}
}
}
}
}
}
The first authentication with 3DES, the change to aes key and then the authentication with Aes key works perfectly.
Then when I tried to change to old 3DES key I received a error and now the card is still "authenticated" with AES key
For completism, the keys are
private let aesZero = Data(repeating: 0x00, count: 16)
private let threeDESZero = Data(repeating: 0x00, count: 24)
I received this error from SDK logs (see the attachments).
Exception Caught: com.nxp.nfclib.exceptions.PICCException: Integrity Error SW2 = 30
Before doing others tests, I hope to know from you if my implementation is working as expected and what that error means.
Thanks in advance