Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write in a emulated card Android HCE (Host card Emulation)

As the HCE was implemented in the version 4.4, I could not find information of how to write in an emulated card.

The android website has a sample of card emulation and a sample of to read the card, but I could not find information about the possibility of writing in a emulated card and how to do it.

I am developing a application that will read an emulated card, it will modify the card and write it again.

Someone know if it's possible and how can I do it?

like image 238
jluiz20 Avatar asked Feb 13 '23 10:02

jluiz20


1 Answers

The question "How [do I] write in a [Android HCE] emulated card?" does not really match the concept of Android HCE.

With Android HCE you do not emulate a memory card, hence there is no such thing as writing to/reading from such an emulated card by default. Instead, you emulate an APDU based smartcard application (note: application, not memory area, not whole card). APDUs are commands that you can send to a card (for instance with a PC/SC-compliant contactless smartcard reader). These commands are then interpreted by your emulated smartcard application (i.e. your HCE service) and used to generate response messages.

So, to summarize, you define the commands (based on ISO 7816-4 APDU structure) that your application should understand and the response message format (again based on ISO 7816-4 APDU structure) that your application sends back.

like image 60
Michael Roland Avatar answered Feb 16 '23 02:02

Michael Roland