Mifare Classic & Ultralight Extension

I think I solved.
Attached my extension,
the source of the extension,
and an app inventor project for test.
At this moment the extension provide some information of a Mifare Classic Tag:

  • Uid
  • Type
  • Size
  • Number of Sectors
  • Number of Blocks

It should works also with Mifare Ultralight (but I don't have this kind of Tag to try)
To test the .aia you have to create and install the .apk
and the NFC in your smartphone must be enable

Who interested about this extension try it, and feel free to modify.
mifare.info.aix (12.7 KB)
MifareInfo.txt (9.7 KB)
MifareInfo.aia (14.6 KB)

Best Regards
Marco

5 Likes

Nice Extension @Marco_Perrone

I saw only two people who made an extension for NFC, so Congratulations @Marco_Perrone :star_struck: :kissing_heart:

And @Taifun please take a look at this. Thank you :pray: :grin:

Thank You very much Salman
:wave:t2:

1 Like

thank you for your contribution...
please edit your post and add a little bit of documentation...
which properties, methods and events are available? how to use it?
thank you
added in the extensions directory... https://puravidaapps.com/extensions.php

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

This is the new version of my MifareInfo extension.
In this version I have added some feautures:

  • Authentication with Key A
  • Read Block
  • Write Block
    The extension have some events and property and functions here a small explanation.
    The following events work when You approach a Mifare Tag to your smartphone with the app opened:
    image
    Provide the Mifare Tag Uid
    image
    Provide the Mifare Tag Type
    image
    Provide the Mifare Tag bytes size
    image
    Provide the Mifare Tag number of sectors
    image
    Provide the Mifare Tag number of blocks
    image

Provide all the info data of the last Mifare Tag approached
image

True to read a block, false to write a block
image

Provide the Key A necessary for the Mifare Classic Authentication after this it is possible Read or Write a block if the Key is correct and has the permission to do it.
The default Key A is FFFFFFFFFFFF
The Mifare Tag must be near the Android device
image

Read the Block specified (after the authentication) with a number between 0 and the number of blocks minus 1
The Mifare Tag must be near the Android device
The extension calculate the Sector to authenticate

image

Write the Block specified (after the authentication) with a number between 1 and the number of blocks minus 1.
The Mifare Tag must be near the Android device.
The extension calculate the Sector to authenticate
The data to be written must not be greater than 16 bytes, HEX format.
If You write less than 16 bytes the extension add 0 tho the remain bytes

N.B. Not all the blocks are equal in a Mifare Tag, every sector has blocks for user data and a block called sector trailer, here are stored the authentication key and the access bits. So You must pay attention to write data in the correct block or your Mifare Tag could become unavailable. Before to start write data is good to read this document to understand how Mifare Tag works https://www.nxp.com/docs/en/data-sheet/MF1S50YYX_V1.pdf

Here my latest files:
mifare.info.aix (15.9 KB) Extension
MifareInfo.txt (15.0 KB) Source file
MifareInfo.aia (27.7 KB) Project test

N.B. After You install the .apk the first time You approach a Mifare Tag to your device a pop-up wil ask You if You want to use the default NTAG Info app or our MifareInfo (or your project) , You must select MifareInfo (or your project) otherwise when You approach a Mifare Tag the intent will not go to our app

1 Like

Here the new extension with Mifare Ultralight support

Hi everybody,
I improved my extension and I added the support for Mifare Ultralight technology, it is different from Mifare Classic (obviously). There are 3 differents types of ultralight tags:

  • Ultralight (no authentication)
  • Ultralight C (3DES authentication)
  • Ultralight EV1 (32-bit password + password acknowledge)

The memory is divided into pages and each page is 4 bytes, in the memory there are some special bytes for the uid, for the password and so on, and obviously the bytes for the user.
For more information:



With this new extensions I added some functions and updated of old ones.

image
Get the UID of Mifare Classic and Mifare Ultralight

image
Get the Type of Mifare Classic and Mifare Ultralight

image
Offset number of the page to read.

image
Page contains the 4 pages read starting from the offset specified in the previous property

image
Write a page in a Mifare Ultralight Tag
Page: the page number of the tag
DataToWrite: the data (4bytes)

If Your tag is not protected You can use the functions above as are.
Instead if your tag is protected or You want to enable the authentication I developed the functions for Mifare Ultralight EV1 (for now)

image
Write the password (4bytes) and the pack (2bytes) in the special pages of the tag.
How does it work? When You try to authenticate if the password is correct the tag reply with the pack and if the pack has the value that You expect means that the tag is correct (the extension do the check for You)

image
After You wrote the Password and the Pack, You can enable the Protection starting from the page number.
Enable: true or false (enable or disable the protection)
PageNumber: usally 4 because is the first page for user data

image
The Password value to use when the tag is protected

image
The Pack value to use when the tag is protected

Obviously when the protection is enable You need to authenticate before to change the password, pack or disable the protection.

Here my latest files:
mifare.info.aix (21.8 KB) Extensions
MifareInfo.txt (30.0 KB) Source code
MifareInfo.aia (38.3 KB) Project test

Best Regards
Marco

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.