Skip to content

Android/Java application for changing the Master Application Key on Mifare DESFire NFC tags from DES to AES and vice versa.

License

Notifications You must be signed in to change notification settings

AndroidCrypto/DESFireChangeMasterAppKey

Repository files navigation

Mifare DESFire Change Master Application Key to AES or DES or vice versa using NFCjLib library

This app has a very limited purpose: it can change a Default DES Master Application Key to a Default AES Master Application Key and vice versa only. A functionality like this can be useful if you are working with other Mifare DESFire libraries that are only able to work with AES keys.

A Mifare DESFire EVx tag has a fabric setting with a Master Application Key of DES length (8 bytes long), filled with (hex) 0x00:

Defaut DES key: 00 00 00 00 00 00 00 00

For changing this key you need to authenticate with this key first and then run the changeKey method on the tag. As this command is working with encrypted data I'm using the Desfire Tools for Android library for these tasks. The Default AES Key is 16 bytes long and filled with (hex) 0x00:

Defaut AES key: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

If you should have changed the Default DES or Default AES Key to any other value then the default value you need to change the keys back to the default ones on your own (this app is working with the Default Keys only !).

Application after start

If you need some basic information about the tags I recommend this document, written by Daniel Andrade (and others) who wrote the NFCjLib: https://github.com/andrade/notes-about-desfire/blob/master/nfc-0.4.pdf

About this app:

It is developed using Android Studio version Jellyfish | 2023.3.1 Patch 2 and is running on SDK 21 to 34 (Android 14) (tested on Android 8, 9 and 13 with real devices).

Some notes on typical sessions with the card: I recommend that you lay your phone on the tag and after the connection don't move the phone to hold the connection.

The usage of the app is described in an article I published on medium.com: https://medium.com/@androidcrypto/mifare-desfire-evx-nfc-tag-change-the-master-application-key-from-des-to-aes-android-java-e5dcf02861ff

Ready to use compiled and build debug app

A ready to use app in DEBUG mode is available under the debug folder.

Dependencies

I'm using 1 external dependency for this project, but I did not load it with Gradle but included the source code. This is specially due to the fact that I'm trying to understand how the workflow for the communication with the Mifare DESFire tag is going on. The best way for this is to have a direct access to the underlying source code.

The main library for the access to Mifare DESFire tags are the DESFire Tools for Android, written by Thomas Skjølberg ("skjolber"), available here: https://github.com/skjolber/desfire-tools-for-android

The licenses for this library are a mixture:

I'm using an app icon created by Ahkâm and then changed for this app: Nfc Simple PNG Transparent Background: https://www.freeiconspng.com/img/20581

Nfc Png Simple

I used this online service to change the icon to my needs: Icon / Vector editor: https://editor.method.ac/

About

Android/Java application for changing the Master Application Key on Mifare DESFire NFC tags from DES to AES and vice versa.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •