NFC
Tizen enables you to use Near Field Communication (NFC) functionalities, such as reading and writing tags, and emulating a smart card. NFC is an international standard that specifies an interface and a protocol for simple wireless interconnection of closely coupled devices. For more information, see the NFC Forum.
The main features of the NFC API include:
- NFC management
The Manager API (in mobile and wearable applications) provides functions, for example, for:
- Initializing and deinitializing NFC
- Enabling and disabling NFC
- Setting callbacks for NFC events
- Managing NFC connections
- NDEF support
The NFC Data Exchange Format (NDEF) is a packet message format used in the reader/writer and peer-to-peer modes.
The NDEF API (in mobile and wearable applications) provides functions for:
- Creating NDEF records
- Retrieving a specific field of an NDEF record
- Creating NDEF messages
- Inserting and removing NDEF records to and from an NDEF message
- Reader/writer mode
The TAG API (in mobile and wearable applications) provides functions, for example, for:
- Retrieving the tag type
- Reading an NDEF message from a tag
- Writing an NDEF message to a tag
- Formatting a tag for using NDEF
- Handling type-specific tag operations (currently only MIFARE)
- Peer-to-peer mode
The Peer to Peer API (in mobile and wearable applications) provides functions for:
- Sending an NDEF message to a peer device
- Receiving an NDEF message from a peer device
- Card emulation mode
The card emulation mode allows an NFC device to function as a smart card. The mode provides access to secure elements (SEs).
The NFC controller in the device routes all data from the reader directly to the secure element, and an applet handles all of the data in the SE. The user does not participate at all in the operation.
Figure: Traditional card emulation
The Card Emulation API (in mobile and wearable applications) provides functions for:
- Enabling and disabling the card emulation mode
- Retrieving the card emulation status
- Opening and closing a secure element
- Sending an application protocol data unit (APDU) to a secure element
- Retrieving an Answer To Reset (ATR) from a secure element
Note Pay attention to the following: - Secure element access is not supported in Tizen 2.3. The Card Emulation API of Tizen 2.3 only supports enabling and disabling the NFC card emulation mode, and retrieving the card emulation status.
- Security problems can occur in some Card Emulation APIs. The security level can be determined by the manufacturer usage. If a security issue occurs, contact the product manufacturer. For more information on the security levels, see the GSMA specification.
- Host-based card emulation (HCE)
HCE is on-device technology that permits a phone to perform card emulation on an NFC-enabled device without relying on access to a secure element (SE). The data is routed to the user space on which Tizen applications reside, instead of routing the data to a secure element.
Figure: Card emulation with HCE
HCE allows you to create your own card emulation system and bypass the SE. This approach brings 2 advantages:
- In case of UICC type SE, the mobile service provider is involved in the card emulation behavior. With HCE, you are free from the provider influence.
- You do not need SE hardware chips within the device.
The understand HCE behavior, mainly how data is internally routed to the correct application, consider how Tizen handles NFC routing:
- Assume that the user has an HCE application or installs one.
The application has a "AID" value, which is stored in NFC routing table (blue arrow in the following figure).
- When the NFC reader attempts card emulation, the NFC controller checks the routing table to find the application to which the data is sent for emulation (red arrows in the following figure).
- When the application is uninstalled, the AID value is deleted from the routing table.
Figure: HCE routing