Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GPB choosable for factory formatting #306

Open
Warborn123 opened this issue Sep 3, 2020 · 3 comments
Open

Make GPB choosable for factory formatting #306

Warborn123 opened this issue Sep 3, 2020 · 3 comments

Comments

@Warborn123
Copy link

Hi, I just realised that when I try to do a factory format on a CUID Card (or Chinese magic card, gen 2), the last sector's access condition will become FF0780BC. I know the last last byte of the access condition is knid of useless, but I still don't understand why it is not FF078069. Thank you.

@Warborn123 Warborn123 changed the title Access condition of last sector when factory formatting Access condition of the last sector when factory formatting Sep 3, 2020
@ikarus23
Copy link
Owner

ikarus23 commented Sep 3, 2020

Hi! The 0x69 is in there because it refers to non-personalized cards according to AN10787 - MIFARE Application Directory (MAD). The "General-purpose byte (GPB)" might be different when a MAD is in use.

However, I'm not exactly sure, why the last GPB of a 1k MIFARE Classic card is 0xBC. I've never looked into MAD deep enough (it's on the todo list #30). I've just set it to 0xBC because factory new original tags by NXP had it set to 0xBC.

It's on 0xBC on other examples as well: http://nfc-tools.org/index.php/Libnfc:nfc-mfclassic.

@Warborn123
Copy link
Author

Hi! The 0x69 is in there because it refers to non-personalized cards according to AN10787 - MIFARE Application Directory (MAD). The "General-purpose byte (GPB)" might be different when a MAD is in use.

However, I'm not exactly sure, why the last GPB of a 1k MIFARE Classic card is 0xBC. I've never looked into MAD deep enough (it's on the todo list #30). I've just set it to 0xBC because factory new original tags by NXP had it set to 0xBC.

It's on 0xBC on other examples as well: http://nfc-tools.org/index.php/Libnfc:nfc-mfclassic.

I actually never own any new NXP tags (since its NUID is not writeable), so I can't really check that myself. From what I saw MIFARE CLASSIC 1K/4K USER MANUAL Release 1.1.0 P.9, the last bit is for "user data", so it's kind of a strange choice to see 0xBC here (actually the 0x69 doesn't make any sense here either, now that I think about it, maybe its there to distinguish from Key B). Anyways, not important, maybe give us an option to chooe that if you have time. Thanks :)

@ikarus23
Copy link
Owner

ikarus23 commented Sep 3, 2020

Hehe, sure. But no promises. I feel that this is a rarely needed corner case ;) Also, the 0xBC seems to be the right state for factory formatted tags.

@ikarus23 ikarus23 changed the title Access condition of the last sector when factory formatting Make GPB choosable for factory formatting Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants