schorschii / MensaGuthaben-iOS

Read the balance of your mensa/canteen card
GNU General Public License v3.0
23 stars 3 forks source link

Non-functional Cards #6

Open schorschii opened 1 year ago

schorschii commented 1 year ago

The following cards were reported as non-functional. Please leave a comment here if you know more cards which are not working.

If you have a card from the list which you can send me for a few weeks, please let me know. I'm interested in supporting these cards.

kiliankoe commented 1 year ago

TU Dresden Campuscard (currently known as technically not possible to read them)

Oh that's very unfortunate :/ Can you elaborate?

schorschii commented 1 year ago

I do not own a Campuscard myself but had the chance for a quick test with one from the team implementing it as library card in the SLUB. This sample was not working with my app and since it uses a different technology, I'm not even sure if the balance is still stored on this card. Nevertheless, even if it is stored, only authorized applications with its key can read/write specific parts of the card, as the team told me. This means that the mensa can administer their content with their key without being able to view the SLUB part on the card, which is actually a good concept.

kiliankoe commented 1 year ago

That does sound like a very sensible concept, good to know, thanks! But it's a pity that the data is likely not accessible anymore. I'll keep looking for more information or see if the StuWe is willing to shed some light on this.

willimei commented 1 year ago

I have talked to the university about this issue and they said that the Mensa application on the CampusCard is the same as before. Furthermore it still seems to be possible to read the card with the "Mensa Guthaben" Android App.

So maybe I can provide you some information to fix this issue?

kiliankoe commented 1 year ago

That sounds super interesting! If you have more information to share, that would be fantastic.

willimei commented 1 year ago

This morning I also got the information that the new card is a SmartMX card with a Mifare DESfire EV2 emulation. Because of that the CampusCard needs a higher electromagnetic field strength to boot the emulation.

I have downloaded several NFC Reader Apps on my phone. One of them showed me that the Emeal card is a DESFire EV1 and the CampusCard is a DESFire EV2. Maybe this helps to find the problem in the App implementation.

Can you give me some more advice what I can do to debug this issue? If needed it will also be possible to meet somewhere if you want to have a look on it by yourself.

schorschii commented 1 year ago

Thanks for your information. Indeed, the Android app can read the card! I just tested it and it worked. This was new for me, it didn't worked when I tested it previously, obviously too hasty.

Next, I checked the debug output of my code reading a Campuscard, and it prints: https://github.com/schorschii/MensaGuthaben-iOS/blob/9dc6da8580a943c0b169952178b21adedcb6436e/Mensa-Guthaben/MainViewController.swift#L213 Turns out the card is recognized as NFCTag.iso7816 and not as NFCTag.miFare. It looks like that Android does some kind of conversion automatically, since the Android App did not received an update since years.

Unfortunately, NFCTag.iso7816.sendCommand() takes other parameter than NFCTag.miFare.sendCommand(), so further changes are necessary. Since I still not own a Campuscard myself, I still depend on the test card of my colleague and the story continues tomorrow...

schorschii commented 1 year ago

I successfully implemented support for the TU Dresden Campuscard. Thanks to @xivy99 and @pauls94 for the sample card!

schorschii commented 1 year ago

@kiliankoe , @willimei any feedback?

willimei commented 1 year ago

I downloaded the update yesterday and it works perfectly. Thank you!

kiliankoe commented 1 year ago

Only just now had a chance to look at the code, huge thanks for the update! Just out of curiosity, how did you come across D2760000850100 for the info.plist value?

schorschii commented 1 year ago

This is the Mifare DESFire Tag application identifier. The campuscard is a NXP SmartMX3 with Mifare DESFire emulation, so we have to select the DESFire functionality with this AID. On iOS, it is necessary to explicitly specify the AIDs to use in the info.plist, on Android, the selection of DESFire seems to work somehow automatically.

kiliankoe commented 1 year ago

Ah, that's good to know, thank you!