Hi,
now the app no longer crashes. Thanks for that hint.
I guess to save other people a lot of time this info should go into the "UG10045.pdf" document.
I can now successfully select the application. I have some trouble now to get the authentication and reading of a file working. Here is the info about the card.
Card Type: Desfire EV2
Crypto: AES
File number: 1
File Type: Standard Data File
Communication: Fully enciphered
Read access with Key Number: 1
File data: 10 bytes
Here is my current code:
desFireEV2.selectApplication(withAppID: appID) { success in
print("selectApplication: success \(success)")
}
desFireEV2.authenticate(withCardKeyNo: 1, withAuthenticationType: .AES, withAuthKeyType: .AES128, withCommandSetForAuth: .Native, withAuthkey: aesKey) { success in
print("authenticate: success \(success)")
}
desFireEV2.readData(withFileNo: 1, withOffset: 0, withLength: 10) { data, success in
print("readDataWithFileNo: success \(success) - data = \(data)")
}
Authentication returns "success = true"
When calling"desFireEV2.readData" readData returns "success = false" and I see the following in the log
Command sent to card : F501
MIFARE CAPDU -> f501
[general] response.tag.type: DESFire
[general] response.responseData: {length = 1, bytes = 0xae}
Response received : AE
An exception occurred: ItF9fDb
Here are some details: com.nxp.nfclib.exceptions.PICCException: Authentication Error SW2 = -82
When I change the "withCommandSetForAuth" to ".ISO" I receive the following in the log
Command sent to card : 90F50000010100
MIFARE CAPDU -> 90f50000010100
[general] response.tag.type: DESFire
[general] response.responseData: {length = 2, bytes = 0x91ae}
Response received : 91AE
An exception occurred: ItF9fDb
Here are some details: com.nxp.nfclib.exceptions.PICCException: Authentication Error SW2 = -82
I'm not sure what I'm doing wrong here. Can you please help. This seems to be the last blocker to resolve.
Thanks,
Martin