Open tomaspre opened 1 year ago
@maxieds Since you wrote this code, could you please give me your opinion on this? Thanks!
@tomaspre Do you have a spare Chameleon Mini device for me to debug with? That would facilitate bug fixes.
I think that the DESFire datasheets I looked at when developing the DESFire emulation (see links here) specify that if there is no existing state (or state has reset), the first thing is to authenticate to the PICC master application. The problem is probably that the first (legacy) round of authentication needs to use DES or 3DES as an encryption scheme. It seems reasonable to let the scheme be AES128 if the tag is configured that way.
When running the DESFire config, I'm not able to authenticate to any app (except the PICC master app) unless I authenticate to the PICC master app first. Therefore, a card can be set up without any problems, but when the authentication state is reset, access to all apps (except the master one) is lost, even if the reader authenticates with the correct key for that particular app.
Example output from
pm3
of what does not work (auth to a previously created application):This could potentially be fixed by removing the following lines from
DESFire Instructions.c
(around line 2014, in functionDesfireCmdAuthenticateAES1
):Is this the correct approach? According to my testing, everything works as expected after commenting out these lines. Does anyone have an opinion on this? I can submit a PR if necessary.