I wanted to use the Mifare Desfire chip for product authentication purposes, where the chip would be embedded into products. As such, I am looking for a NFC solution that makes it virtually impossible(or as hard as possible) to clone the chip.

The current solution I had in mind using the Desfire was to use the supported symmetric authentication to have a memory-locked part of the chip where we would store the product information. Then we would create diversified keys, using a master key, UID of the chip, and some metadata and use that diversified key to conduct the symmetric authentication(more information on it can be found here.

Now, the problem lies in the fact that the symmetric authentication has to be done on an android app, meaning we would have to store the master key on the android app or send it over network to a potentially malicious version of the app. So I was wondering if anyone had a suggestion on how to protect the master key or an entirely different authentication solution to prevent chip cloning using the Mifare Desfire or other similar NFC chips.


The key does not need to reside on the app.

When you ask for authentication, you will get a random number, encrypted with the key, back. This random number, you can send back to the server with the app, and let the server do the authentication with key. The server will then send you a new encrypted packet with a encrypted value, that you just forward to the chip. Then you will get a response from the chip, that you send back to the server.

After that, the cell you are using could contain some product info, "signed" with a MAC. This product info and MAC is also sent to server as a final phase. Only after all the steps completed successfully, product is genuine.

If you use any libraries to do NFC communication, you must run these in manual mode to be able to authenticate this way.

It is possible to create a rogue app that will read the resulting data and copy the product info inclusive the MAC, and then insert this into a fake DESFire EV1 chip that will accept any authentication. This is why the server must validate the random value that is returned, that this successfully decrypts to the value the server initially selected, but shifted to the left. (read the implementation details on how you do a authentication).

By using keys that cannot write the chip, you also prevent someone from updating a genuine chip to contain information about a product more expensive than the product the chip resides on.

Be also careful that someone may move the chip from a genuine product to a fake product, and then keep the genuine product itself, and sell the fake product. Use tamper-resistant chips for this, that will stop working once they are removed from the product. Or tie the product to a service requiring authentication with the app to work, thus the genuine product that the fraudster have will be useless without the chip.

  • Hi @sebastian thank you for your reply, I think it has put me on the right path to find a solution. Just wanted to clarify one point about your answer. My understanding of your answer is to perform a mutual three-pass authentication between the Desfire and the server with the android application simply acting as a middle man. Is that correct? – LongJeongS Dec 22 '16 at 0:26
  • @LongJeongS yes, exactly. The android app just acts as a translator & display between NFC and network. – sebastian nielsen Dec 23 '16 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.