3

I need to read some NFC cards by a USB reader on a Linaro/Debian OS.
The USB reader has a HID profile.
Presenting a 13,56 MHz card the keyboard returns a code.

I read about a command to send to the device but, since it is a (virtual) keyboard, I cannot send commands, and toward which device?
How to dump the memory of the card?

Thanks

2
  • Maybe explain: What's your reader exactly, and what type of cards do you want to read? Maybe you should just pick another reader, like one of shop.reiner-sct.com/…
    – U. Windl
    Commented Jun 4, 2023 at 21:02
  • "I read about a command to send to the device but, since it is a (virtual) keyboard, I cannot send commands" - Why would you write that without writing out what commands you read about?
    – pipe
    Commented Jun 4, 2023 at 22:20

2 Answers 2

8

In the comments of Marcus Müller's answer, you said the reader is an Elatec TWN4 Multitech 2.

According to the documentation in the Elatec DevKit, it has different firmware packages to support different interfaces, and your reader seem to be currently programmed with a USB keyboard interface firmware, which only provides very limited functionality compared to the other firmware packages.

You would have to install a different firmware into your reader (using Elatec AppBlaster, which is unfortunately a Windows application) to enable a different type of interface.

If I understood correctly, your reader's current firmware is either TWN4_CK*.bix or TWN4_NK*.bix, where the K denotes a USB keyboard interface.

Instead, you might want a TWN4_CC*.bix or TWN4_NC*.bix version of the firmware, which provides a virtual COM port interface, which would appear as /dev/ttyACMx in Linux, or a TWN4_CP*.bix or TWN4_NP*.bix version of the firmware, which would provide a USB CCID-compatible smart card reader interface, which would be supported by Linux PCSClite + libccid like most USB smart card readers (libccid version 1.4.28 or newer required).

You might want to choose the firmware according to which type of programming interface you are more comfortable with. The virtual COM port interface might be easiest for testing, but the CCID-compatible interface might be a wise choice if you are planning to develop more extensive applications.

The DevKit includes a number of firmware variants, for different readers and different applications. The Elatec reader has even some space for application code in its firmware, so it can have application-specific firmware if used as part of an embedded system.


Dumping the memory of a NFC card... it depends on what type of a NFC card it is.

If it is a simple memory card, dumping the card memory should be easy. But if it is a smart card designed to hold encryption keys or other secrets, the card would most likely be designed to not allow reading the encryption key - instead you would just send a command to the card together with the data to encrypt/decrypt, and the card's processor would do the job for you, without ever disclosing the actual key.

The processors of such smart cards run a hardcoded program, which presents a carefully limited API via the card reader: there should be simply no way to get a properly designed and initialized smart card to dump any secrets from their internal memory.

2

I don't think there's a standardized profile for talking to NFC cards via USB HID. (that makes little sense to me in the first place – NFC is actually more of a serial link than say, a keyboard.) That's different for a few specific card types – FIDO U2F would come to mind; there's a specification for U2F-over-USB-HID.

So, as far as I can tell this depends 100% on the specific reader device you're using – luckily, major players in that field typically do publish at the very least windows driver API documentation, or even lower-level USB description (e.g., HID Omnikey).

3
  • I own an Elatec TWN4 Multitech 2. In their site I see only Windows driver. Using pcsc_scan the reader is not seen ...
    – SteMMo
    Commented Jun 3, 2023 at 13:42
  • The reader as vkeyboard returns a code taht is different from card UID.
    – SteMMo
    Commented Jun 3, 2023 at 13:43
  • yeah, so you have a reader with a nonstandard interface and without a linux driver. Hm, you might simply be in bad luck. Commented Jun 3, 2023 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .