Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NDEF vs APDU NFC Android

Can you tell me please what is the difference between NDEF (NFC Data Exchange Format) and APDU (Application Protocol Data Unit).

I have developed an Android application that reads NDEF messages, and I want to know if it can work for APDU data too.

like image 737
Najoua Mahi Avatar asked Apr 28 '15 16:04

Najoua Mahi


People also ask

What is NFC APDU?

Application protocol data units (APDUs) are special communication units that are used when exchanging data with a Type 4 Tag platform. Command APDUs (C-APDUs) are the commands sent from the NFC reader, while response APDUs (R-APDUs) are the responses to a specific command received by NFC reader from the tag.

How read and write data from NFC tag in Android?

To read the NFC tag, the app needs to register for handling ACTION_NDEF_DISCOVERED intent. Registering this intent will let your app handle any NFC tag that is tapped to the Android device. If you wish to handle only those tags that belong to your application then you can add a filter.

What is Apdu command?

APDU is a command response protocol for invoking functions executed on a smart card or similar device. In essence, the command consists of a 4 byte header followed by up to 255 bytes of data. The response contains a 2 byte header followed by up to 256 bytes of data.

How do I read data on my NFC card?

To get access to the NFC hardware, you have to apply for permission in the manifest. If the app won't work without NFC, you can specify the condition with the uses-feature tag. If NFC is required, the app can't be installed on devices without it and Google Play will only display your app to users who own a NFC device.


1 Answers

NFC Data Exchange Format (NDEF)

NDEF is a wrapper format that allows you to package a data payload together with meta information (such as a data type identification), and that permits combining multiple such packages (so-called "records") in one "message" that can be stored on NFC tags and transfered across an NFC link.

NDEF itself does not define how such data (messages) should be exchanged between NFC devices (i.e. it does not define the communication protocol and commands to read or store such data).

Application Protocol Data Unit (APDU)

APDUs are the command and response packets for communication with smartcards. A command APDU consists of an instruction code and associated parameter data. A resonse APDU consists of response data and a response status code (in response to a preceding command APDU).

What's the difference?

NDEF is data container for storing structured data on NFC tags and transfering such data over peer-to-peer links while APDUs are commands and responses of a communication protocol for smartcards.

Are APDUs and NDEF somehow related?

With NFC Forum Type 4 tags, APDU commands (like READ BINARY and STORE BINARY) are used to read and store NDEF data into a file on that tag type. Other NFC Forum tag types do not rely on APDUs but use other command sets.

like image 193
Michael Roland Avatar answered Oct 22 '22 15:10

Michael Roland