Greetings!
I have developed successful solutions for reading DESFire smart cards used in Croatian public services, both for:
- Dot Net. Multi platform, using pcsc-sharp and "raw" APDU approach.
- Android. Using TapLinx SDK for Android and high level-approach. For example: myDesFire.getUID() instead of raw APDU commands.
Right now, I'm trying to develop multi platform solution in Java, using TapLinx SDK for Java and high-level approach.
I rely on javax.smartcardio for polling connected card terminal to see when smart card is inserted or removed, and it works perfectly. In my testing app (JavaFX if that matters), in onCardInserted event, I'm calling my own cardLogic method. That method tries to connect to smart card.
In Android, it is very simple:
public static Card cardLogic(final Intent intent, NxpNfcLib nxpNfcLib, MyCardKeys keys) {
//... some code ommited for brevity
desFireEV = DESFireFactory.getInstance().getDESFireEV2(nxpNfcLib.getCustomModules());
desFireEV.getReader().connect();
byte[] uid = desFireEV.getUID();
// ...and so on.
In Java, similar method of mine is:
public static Card cardLogic(CardTerminal terminal, MyCardKeys keys) {
//... some code ommited for brevity
javax.smartcardio.Card javaCard = terminal.connect("*");
desFire = DESFireFactory.getInstance().getDESFireEV2(TapLinx.getCustomModules());
// NOW WHAT!???
desFire.getReader().connect(); // This does not work, of course. HOW TO "connect" context of javaCard object with getting a concrete reader, so that...
byte[] uid = desFire.getUID(); //... I can do this without raising an exception?
So, questions are those in comments of the above code snippets. I'm totally stucked. Probably missing something obvious. but I can not figure out the solution, not even when reading code of both sample apps.
Please help.