NXP TapLinx SDK (formerly Mifare SDK) is an high-level sofware library provided by NXP to work with their Mifare, Desfire, NTAG and ICode products.
Written in Java, the TapLinx library has been initially developed for Android, running over Android’s NfcAdapter object to communicate with the contactless cards or NFC tags through the tablet’s or smartphone’s integrated NFC interface.
Recently, the library has been ported to the standard JDK, making it usable in any Java desktop applications thanks to the JRE available on Windows, macOs, Linux, and more. In desktop applications, the TapLinx library relies on the system’s PC/SC stack (javax.smartcardio API in Java) to access the contactless cards or NFC tags through a standard-compliant PC/SC coupler.
This makes TapLinx an interesting solution for developers of desktop applications that have to process NXP cards or tags. This article shows how-to get started with this SDK, in the aim of using it together with SpringCard devices.
Disclaimers
SpringCard is not affiliated, endorsed by, or sponsored by NXP. This article points to services and information that are covered by a license agreement and/or a non-disclosure agreement to be signed between you and NXP. SpringCard provides this article “as is” at the date of writing in the hope that it will be useful – no updates nor support will be provided.
The TapLinx SDK versus its alternatives
No SDK?
NXP TapLinx SDK is not the only solution to work with Desfire, Mifare, Desfire, NTAG and ICode products.
Basically, all these cards and tags could be directly addressed through the SCardTransmit function of the PC/SC API (i.e. the transmit method of the CardChannel object in javax.smartcardio).
For Desfire and Mifare Plus that communicates at T=CL level (ISO/IEC 14443 layer 4) and expose a command set that is valid against ISO/IEC 7816-4 (APDU level), the command APDUs are sent ‘as is’ in SCardTransmit (for instance, 9060000000 for a GET VERSION).
For memory cards like Mifare Classic or UltraLight, NTAG and ICode, things are a little different because these cards operate at ISO/IEC 14443 layer 3 and their command set is not valid against the smart card standards. Anyway, it is very easy to operate them directly thanks to the device’s APDU interpreter:
- Basic features of the card are exposed through GET DATA (FFCAxxxx00), READ BINARY (FFB0xxxxxx) and UPDATE BINARY (FFD6xxxxxx…) APDUs,
- Specific commands are invoked through the ENCAPSULATE instruction (for instance, FFFE0100016000 for a GET VERSION).
The complexity comes when the application has to get authenticated onto the card and to implement secure communication (3DES or AES mutual authentication, CMACed or fully enciphered exchanges). This is perfectly doable with a little background in cryptography and with full access the detailed datasheets of the cards, but it is lots easier to use a library that already implements everything.
The SpringCard SDK for PC/SC
SpringCard provides a free-of-charge SDK (https://github.com/springcard/springcard.pcsc.sdk; the license contract specifies that this SDK can be used only together with a SpringCard device).
At the difference with the TapLinx SDK that is dedicated to Java applications, the SpringCard SDK for PC/SC covers a wider range of technology:
- The SpringCard SDK features native libraries written in C, that are immediately available as DLL for Windows, and could be compiled at your choice as static (.a) or dynamic (.so) libraries on Linux,
- The SpringCard SDK also features .NET libraries written in C#, that could be used from any .NET application both on Windows and on macOS and Linux thanks to the Mono runtime.
But SpringCard does not try to be as exhaustive as NXP in supporting NXP products! We focus on the cards and tags that are used the most by our customers, and on the core functions of the chips. We do not intend to implement everything in a free SDK.
The implementation matrix below highlights the differences:
NXP TapLinx SDK | SpringCard PC/SC SDK (C) | SpringCard PC/SC SDK (C#) | |
Source code | No | Yes | Yes |
Binaries | .JAR (JVM) | .DLL (Win32/x86) | .DLL (.NET / Mono) |
Supported cards | All NXP ICs, all functions | Desfire Desfire EV1 Desfire EV2 and EV3 (partial) Mifare Plus (partial) Mifare UltraLight C | Desfire EV0 Desfire EV1 Desfire EV2 and EV3 (partial) Mifare UltraLight C Mifare UltraLight EV1 |
SAM AV2 / AV3 support | No | Yes (in Desfire lib.) | Yes (in Desfire lib.) |
NFC Forum Tags support | Yes (optimized for NXP tags, no T3T) | No | Yes (supports all T2T, T3T, T4AT, T4BT and T5T) |
NB: although we do not intend to implement everything in a free SDK, we also sell more complete libraries. Please contact our Sales team for details.
Obtaining the TapLinx SDK
The TapLinx SDK is hosted on MIFARE.NET, a web site provided by NXP : https://www.mifare.net/developer/ .
To get access to the SDK and to the documentation, you must create an account on this web site.
Once registered and logged-in, you can download the library (.ZIP file with many .JAR inside), the sample application (a .ZIP file with a Java project tree) and the Application Note ref. AN11876 (direct link). There’s also a link to the JavaDoc of the API (direct link).
NB: our focus in this article the the TapLinx Java (a.k.a. desktop) part. TapLinx for Android is not in our scope.
Before going further, make sure you have installed:
- The Java Developer Kit (JDK) – at the date of writing, current version is 17.
- The Eclipse IDE – at the date of writing, current version is 2021-09. Select “Eclipse IDE for Java Developers”.
Getting started with the basic sample application
A very basic sample application is provided inside the Application Note ref. AN11876 itself.
Extracting the sample project from the PDF
Once you have download AN11876.PDF, open it with a genuine Adobe Acrobat Reader (the following procedure may not be available on basic PDF readers).
Locate the paperclip icon in the navigation panel, and click it.
This shows that the PDF has two embedded files.
Right-click the TapLinxTest-Desktop.nxpzip file and click Save attached file.
Once this file has been saved on your computer, change its extension from .nxpzip to .zip.
Finally, unzip the archive in a new directory named TapLinxDesktopApp.
Inside this archive, sub-directory TapLinxDesktopApp contains a Java project for Eclipse.
Building the project with Eclipse
Launch Eclipse IDE for Java Developers.
In the File menu, click Open Projects from File System… , click Directory, navigate to the TapLinxDesktopApp directory, and confirm.
The project is now open in Eclipse:
Click the Run button or hit Ctrl+F11 to build and launch the Java application.
Using the TapLinx Desktop Sample
The application is based on this single, basic form:
Place a Desfire card on a contactless reader, then select the reader in the list.
The application immediately connects the the card, tries to recognized it and to get authenticated. In the above example, authentication is OK because the PICC Master Key (key of the root application) still has its default (blank) value.
When a card with another key is presented instead, the authentication fails: