NFC with Android Near Field Communication with Android Dominik Gruntz University of Applied Sciences Northwestern Switzerland, Brugg-Windisch 368
NFC Data Exchange Format (NDEF) NDEF > Container format to store NFC data in NFC tags – Independent from tag type > Defines a number of specific
NFC Data Exchange Format (NDEF) NdefMessage > Represents an NDEF (NFC Data Exchange Format) data message > Contains one or more NdefRecords tha
NFC Data Exchange Format (NDEF) TNF Types > EMPTY (0) Empty record (without type / id / payload) > WELL_KNOWN (1) Record contain
NFC Data Exchange Format (NDEF) RTD Types (Record Type Definition) for well-known NFC types > TEXT "T" – Record contains plain text –
NFC Data Exchange Format (NDEF) NdefMessage NdefRecord 14 class NdefMessage { public NdefMessage(NdefRecord[] records); public NdefRecord[]
NFC Data Exchange Format (NDEF) NDEF Record Layout > MB = Message begin > ME = Message end > CF = initial or middle chunk of a chunked record
NFC Data Exchange Format (NDEF) Mifare Tag with NDEF message > 03 = NDEF content > 0F = Length of NDEF message (15 bytes) > D1 = Status = 11
NFC Data Exchange Format (NDEF) Mifare Tag with NDEF message > 03 = NDEF content > 0F = Length of NDEF message (15 bytes) > D1 = Status = 11
Reading NDEF Messages AndroidManifest.xml > Permission to access the NFC hardware > Specify minimum SDK version (2.3.3) > Indication for th
Reading NDEF Messages Intent Filter and Data Field > TNF_WELL_KNOWN / RTD_TEXT > TNF_WELL_KNOWN / RTD_URI or RTD_SMART_POSTER – Scheme manda
NFC Experience NFC at FHNW > 2005/06 First NFC demonstrator (with Siemens CX70 Emoty) – NFC was included in a removable cover > 2009/10 Mobile
Reading NDEF Messages 20 NdefMessage[] getNdefMessages(Intent intent) { NdefMessage[] msgs = null; String action = intent.getAction(); if (NfcAd
Writing NDEF Messages 21 void writeUrlToTag(Intent intent, String url) throws IOException, FormatException { String action = intent.getAc
Peer-To-Peer NDEF Messages Prerequisites > Pushing activity must be in the foreground > Data to be send must be encoded as NdefMessage > Both
Peer-To-Peer NDEF Messages 23 private NfcAdapter nfcAdapter; private NdefMessage pushMessage; public void onCreate() { super.onCreate(); nfcAda
24 AGENDA > What is NFC > NFC with Android: Reading & Writing NDEF Messages > NFC with Android: Beyond NDEF > NFC with Android: Applic
Beyond NDEF Specifications > Protocol Level: 14443-3A / B, JIS6319-4 (Felica), ISO-15693 (Vincinity) > Application Level: 14443-4 (Transmiss
Beyond NDEF 26 Tag getTechList() TagTechnology Tag getTag() void connect() void close() boolean isConnected NfcA get(Tag t) NfcB get(Tag t) NfcF get(T
Beyond NDEF Tag Technology Access > Method Tag.getTechList() returns a list of supported technologies, as fully qualified class names > Example
Beyond NDEF Tag Tag Type Tag Technology NfcA NfcB NfcF NfcV IsoDep Ndef MifareClassic MifareUltralight NdefFormattable Stoos Tag-it HF-I Plus Inlay Ty
Beyond NDEF Tag Technology Dispatching > Intent-Filter can also be specified for particular tag technologies 29 <activity android:name="..
3 AGENDA > What is NFC > NFC with Android: Reading & Writing NDEF Messages > NFC with Android: Beyond NDEF > NFC with Android: Applica
Beyond NDEF Tag Technology Dispatching > filter_nfc.xml contains one or more tech-list entries (qualified class names) > A tag matches if any of
Beyond NDEF Tag Dispatching 31 ACTION_NDEF_DISCOVERED ACTION_TECH_DISCOVERED ACTION_TAG_DISCOVERED enableForegroundDispatch()
32 AGENDA > What is NFC > NFC with Android: Reading & Writing NDEF Messages > NFC with Android: Beyond NDEF > NFC with Android: Applic
Applications NFC Tag Info > Displays card information > Displays the sectors of a tag (hex / ascii) > Displays NDEF content 33
Applications NXP Tag Writer > Supports Reading & Viewing content of a tag > Supports Creating / Erasing / Protecting content 34
Applications WiFiTap Allows to store & load the WiFi configuration on a tag (i.e. Name & WPA/WEP password) NFC TaskLauncher Use NFC tags to
36 AGENDA > What is NFC > NFC with Android: Reading & Writing NDEF Messages > NFC with Android: Beyond NDEF > NFC with Android: Applic
Secure Element Secure Storage in NFC device > Tamper-proof storage for sensible data (money, tickets, keys) > Cryptographic operations > Secu
Secure Element 38 Secure Element non-removable removable Embedded Hardware (Secure IC) MicroSD-Card (Secure MC) UICC over SWP (Secure SIM) Bluetooth
39 AGENDA > What is NFC > NFC with Android: Reading & Writing NDEF Messages > NFC with Android: Beyond NDEF > NFC with Android: Applic
What is NFC NFC (Near Field Communication) > Communication technology based on radio waves at 13.56 MHz frequency > Short range (<= 10 cm the
Self Service Shopping 40
Self Service Shopping Facts > Location: Mini-market, Uf-Stocken, Kilchberg > Pilot start: 12.2009 – 12.2010 > No. of user: 80 consumers
Self Service Shopping: Secure Payment JVM NFC Chip SE Payment Server 1. Reading Tags and collecting data 3. Send Request 2. Computing Hash
ISO 14443-4 compliant Card Access Communication with the Applet with APDU commands byte[] SELECT = { (byte) 0x00, // CLA Class (by
ISO 14443-4 compliant Card Access Communication with the Applet with APDU commands byte[] GET_MSISDN = { (byte) 0x80, // CLA Class (byte)
JavaCard TX Signing Applet Applet implements APDU commands public class TXSigningApplet extends Applet { private final static byte INS_INIT = 0x01;
JavaCard TX Signing Applet byte[] buf = apdu.getBuffer(); switch (buf[ISO7816.OFFSET_INS]) { case INS_MSISDN: apdu.setOutgo
OTA Loader JVM NFC Chip SE Payment Server Applet Midlet 47 TSM
OTA Loader Proxy between Server and SE > Proxy reads requests from server and forwards them to secure element > Proxy may be started by a pu
OTA Loader: Proxy main loop void seCommand() throws IOException, ContactlessException{ short b0 = (short)( is.read() & 0xFF ); short b1 = (s
NFC Device Operating Modes Reader-Writer Mode > Mobile Device is able to read external tags/smartcards, Device becomes RFID reader/writer (and can
Google Wallet Mobile Payment System > Checkout at MasterCard PayPass-enabled terminals > Supported Credit Cards – Citi MasterCard – Google Prepa
Open Questions Secure Element > Who controls the keys of the secure element, i.e. which party can enable "card emulation"? > Will the
Open Questions Security > SmartPoster Spoofing Attack Source: Collin Mulliner, http://www.mulliner.org/nfc/ 52
NFC Next Steps Projects & Trials > Buy Nexus S and upgrade to Android 2.3.4 > Buy NFC Reader & Tags (=> Starter Kits) > Install NF
Dominik Gruntz www.imvs.ch University of Applied Sciences [email protected] Fachhochschule Nordwestschweiz Institut für Mobile und Verteilte Sy
NFC Device Operating Modes Peer-To-Peer Mode > Bidirectional P2P connection to exchange data between devices – Proximity triggered interactions – N
NFC Device Operating Modes Tag Emulation > Device emulates a passive tag (typically a smart card) – Device can emulate (contain) multiple smartcard
Android and NFC Android Gingerbread > Tag reading (2.3.2) > Tag writing (2.3.3) > Limited P2P (NDEF push only, 2.3.3) Android NFC Devices &g
9 AGENDA > What is NFC > NFC with Android: Reading & Writing NDEF Messages > NFC with Android: Beyond NDEF > NFC with Android: Applica
Comments to this Manuals