Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NFC : Tag lost when APDU command sent to a smart card

I am doing an EMV application on Android OS (Samsung Galaxy).

I am able to send several APDU commands without problem but when I am trying to send the internal authentication command. I have this error : Tag lost. Have you got any idea concerning the purpose of this error ? I am not an experimented developer on Android, It may I have forgotten some stuff.

  • the command is correct.
  • I can replace by another command, it works (I mean I can recover a response).

In which cases a NFC communication can be broken on Android?

Here, you can see my problem when the command is sent :

D/ECInfoGrabber(14088): Send: 00 88 00 00 04 14 16 67 3D
D/OpenGLRenderer(14088): Flushing caches (mode 0) D/dalvikvm(14088): GC_FOR_ALLOC freed 227K, 4% free 14298K/14855K, paused 29ms I/dalvikvm-heap(14088): Grow heap (frag case) to 14.142MB for 115216-byte allocation D/dalvikvm(14088): GC_FOR_ALLOC freed 3K, 4% free 14408K/14983K, paused 15ms

Thanks

like image 993
user1571292 Avatar asked Aug 02 '12 11:08

user1571292


1 Answers

One possibility is that the response from the card takes more time than the default time-out setting. This often occurs when the card has to do some internal calculations; typically in case of cryptographic operations such as authentication.

You can change the time-out value using IsoDep.setTimeout():

 IsoDep iso = IsoDep.get(tag);
 iso.connect();
 iso.setTimeOut(5000); // 5 sec time out
 iso.transceive(apduCommand); // now send your command 
like image 109
NFC guy Avatar answered Oct 19 '22 23:10

NFC guy