Upgrade to Pro — share decks privately, control downloads, hide ads and more …

NFC - One Small Tap for Mankind

Arnav Gupta
September 16, 2016

NFC - One Small Tap for Mankind

Exploring NFC and Bidirectional Communication using NFC

Arnav Gupta

September 16, 2016
Tweet

More Decks by Arnav Gupta

Other Decks in Technology

Transcript

  1. NFC Near field communications - a short range wireless standard

    using small antennae. (Produces modulated E or M waves). Developed on the basis of RFID devices. NFC brings 2-way communication and reading of unpowered ‘tags’ Used today for payments, identification, ticketing, social media checkins, hotel room checkins.
  2. NFC : the history 2004 : Nokia, Philips and Sony

    form NFC Forum 2006 : Nokia 6131 - First ever NFC phone 2009 : NFC Forum releases peer-to-peer sharing protocols 2010 : First Android NFC phone - Nexus S 2011 : Google I/O - “How to NFC” 2012 : NFC Based payment solutions emerge. Google Wallet. 2013 : Visa, Mastercard start working on NFC solutions. 2014 : Apple Pay, Poynt, IBM 2-factor NFC Authentication
  3. NFC : pros ➔ Pairing not required ➔ Versatile. Can

    be incorporated in many devices ➔ Minimal power usage ➔ Minimal user interaction ➔ Seamless procedure
  4. NFC : cons ➔ Compatibility issues ➔ Low speed ➔

    Absence of security in HW layer ➔ Barebone communication channel (without flow or error control)
  5. NFC on Android • Read NFC Tags or Cards •

    Use Mobile as Wallet (inbuilt Secure Element) • Beam data from one Mobile to another • Emulate a card (HCE) • Reader mode to read emulated card
  6. NFC on Android : Tag me out ! ACTION_NDEF_DISCOVERED Well

    defined NDEF data received. Easiest way to read tags (given they send a proper NDEF message on energizing them) ACTION_TECH_DISCOVERED Fall back from above. If no app has NDEF discovery filter, or the data from the tag is not in NDEF format ACTION_TAG_DISCOVERED Last resort. Gives only info that tag is discovered. No data available. Can be rarely used for meaningful application.
  7. <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED"/> <category android:name="android.intent.category.DEFAULT"/> <data android:mimeType="text/plain" /> </intent-filter> <intent-filter>

    <action android:name="android.nfc.action.NDEF_DISCOVERED"/> <category android:name="android.intent.category.DEFAULT"/> <!-- TAP TO GO TO URL --> <data android:scheme="http" android:host="developer.android.com" android:pathPrefix="/index.html" /> </intent-filter>
  8. NFC on Android : Beam of hope ★ Introduced in

    Android ICS 4.0 ★ Unidirectional data transfer (short bursts) from one device to another. ★ Needs both devices to have unlocked lockscreens and tapped together. ★ Using SNEP (Simple NDEF Exchange Protocol) ★ Communication initialised only after “Tap to Beam”
  9. NFC on Android : Beam of hope ★ Vast functionality

    additions in 4.1 ★ Larger data (Images/Videos/Audio) transfer possible. ★ For larger data, actual sending takes place over Bluetooth. NFC is used for pairing. ★ Samsung S-Beam uses Wifi-direct instead
  10. Android NFC : Host-based Card Emulation ★ A term coined

    by SimplyTapp in 2011 ★ First official implementation via collaboration of SimplyTapp with CyanogenMod ★ Added in Android officially in Kitkat 4.4 ★ Allows apps on an Android phone to emulate a NFC Tag (i.e. software emulation) without usage of Secure Element ★ Support from Visa and MasterCard poured in
  11. Android NFC : Host-based Card Emulation ➔ Each packet is

    called “APDU”. ➔ APDU is 256byte or 64Kb in size - Check isExtendedLengthApduSupported() and getMaxTransceiveLength() ➔ Select AID : [Class | Instruction | Parameter 1 | Parameter 2] ➔ Get/Put AID : [Class | Instruction | Parameter 1 | Length | Data] ➔ Each emulated card is presented as an object of class IsoDep
  12. Android NFC : Host-based Card Emulation READER CARD onTagDiscovered ←

    SELECT_AID → Card App with given AID started Confirm AID ← App starts, channel opened GET_DATA → Parse command payload, Use data as needed ← Send back appropriate data PUT_DATA → Parse command payload Receive OK status ← Modify data, send ACK/NAK back
  13. Android NFC : Host-based Card Emulation Host based card emulation

    allows 2-way sustained communication between Android devices. Key to bi-directional data transfer is iteration over multiple GET_DATA, PUT_DATA calls, and sending information in packets. Communication will be half-duplex. With a practical speed limit of ~10Kbps
  14. Android NFC : Current Usages ❏ Payments/Commerce ❏ Enabling/pairing other

    connections ❏ Social networking ❏ Ticketing ❏ Identity and Access Tokens ❏ HealthCare ❏ Automation
  15. Android NFC : Challenges & Limitations ❏ Nascent stage in

    industrial application ❏ libnfc lacks uniformity across vendors ❏ NXP chips not having extended APDU and HCE support. ❏ Lack of support for all tag data formats (NDEF, APDU) in standalone readers