Jump to content

Welcome to CyanogenMod

Welcome to our forum. Like most online communities you must register to post, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of the CyanogenMod Forum by signing in or creating an account. You can even sign in with your Facebook or Twitter account.
  • Start new topics and reply to others
  • Subscribe to topics and forums to get automatic updates
  • Get your own profile and make new friends
  • Download files attached to the forum.
  • Customize your experience here
  • Share your CyanogenMod experience!
Guest Message by DevFuse
 

NFC Secure Element Hack


  • Please log in to reply
4 replies to this topic

#1 tbellenger

tbellenger
  • Members
  • 1 posts
  • Twitter:tbellenger
  • Country:
    au - Australia
  • Device Model:
    HTC Desire
  • CM Version:
    7
  • Recovery Image:
    ClockworkMod

Posted 25 February 2011 - 03:04 AM

Is there anyone out there that has tried following the vague instructions here (http://www.nearfield...d-the-nokia-c7/) to hack the NFC secure element on the Nexus S? I tried looking through the code (both the libnfcxxx.so and the NFCAdapter parts) but I'd be interested to know if someone on here has gotten further. Even as far as communicating with the secure element (through an app not the NFC interface).
Cheers,
Tom

#2 JMC114

JMC114
  • Members
  • 2 posts
  • Twitter:JornC
  • Device Model:
    Nexus S
  • CM Version:
    CyanogenMod-7.0.0-NS
  • Recovery Image:
    ClockworkMod

Posted 26 April 2011 - 11:25 AM

I've recompiled CyanogenMod to allow for communication with the secure element, but it fails with an error in the C++ code, somewhere after it calls INativeNfcAdapter.doOpenSecureElementConnection() if I remember correctly.

I've traced it back to a C++ function that tries to get the tech list of the tags it's found on the secure element (it finds 2, for some reason) where it fails to convert everything it's found back to a java array (I think). I tried fixing it by just ignoring the tech it finds - recompiled it, flashed it, still gives error. Which leads me to believe there's something wrong with the JNI (Java Native Environment) in that particular instance that fails to create a java array. Or something.

Due to my inexperience with C++ I've given up on it for now.

Edited by JMC114, 27 April 2011 - 08:23 AM.


#3 Petr Polak

Petr Polak
  • Members
  • 1 posts
  • Device Model:
    Nexus S
  • CM Version:
    7 - from sources
  • Recovery Image:
    Cyanogen

Posted 14 May 2011 - 12:09 PM

Hi,
  I managed to enable secure element and switch device (A) to card emulation - it is now detected by common Contacless reader. I can send commands - eg. ask to select AID using eg. another phone in reader mode (B) and send any command - the phone is discovered as a Tag. I can see these commands received in the log of phone A. The problem is it is somehow "wired" to secure element - I can not answer (even do not see the answers anywhere in the logs) of phone A, it is just received by phone B. This makes it impossible to simulate card I need - it is really wired in HW somehow.


  Does anybody know how to enable real emulation - so I can answer a command send by reader? I thought I will be able to influence secure element communication, but no luck ... ;-(

  Thanks a lot

#4 papananasya

papananasya
  • Members
  • 1 posts
  • Device Model:
    Nexus S
  • CM Version:
    cynogenmod-7-03022011-nightly-ns
  • Recovery Image:
    ClockworkMod

Posted 20 May 2011 - 03:52 AM

Hi,
I interested in how to enable secure element and switch device (nexus s) to card emulation, can you share this how-to (tutorial). Right now I'm researching about near field communication for college. Thank you :)

 Petr Polak, on 14 May 2011 - 12:09 PM, said:

Hi,
  I managed to enable secure element and switch device (A) to card emulation - it is now detected by common Contacless reader. I can send commands - eg. ask to select AID using eg. another phone in reader mode (B) and send any command - the phone is discovered as a Tag. I can see these commands received in the log of phone A. The problem is it is somehow "wired" to secure element - I can not answer (even do not see the answers anywhere in the logs) of phone A, it is just received by phone B. This makes it impossible to simulate card I need - it is really wired in HW somehow.


  Does anybody know how to enable real emulation - so I can answer a command send by reader? I thought I will be able to influence secure element communication, but no luck ... ;-(

  Thanks a lot


#5 m0rtadelo

m0rtadelo
  • Members
  • 4 posts
  • Device Model:
    Samsung Galaxy S
  • CM Version:
    Official
  • Recovery Image:
    Stock

Posted 13 October 2011 - 07:52 AM

 papananasya, on 20 May 2011 - 03:52 AM, said:

Hi,
I interested in how to enable secure element and switch device (nexus s) to card emulation, can you share this how-to (tutorial). Right now I'm researching about near field communication for college. Thank you Posted Image


I managed to enable card emulation on Nexus S on stock (2.3.4_r1) sources. I added a pair of useful options to the settings application too. The patches are downloadable from xda-developers.

Some comments about my card emulation experience on Nexus S are posted here:

Maybe someone could adapt those patches to stable CM7 so card emulation functionality can grow inside CM community.