-
Notifications
You must be signed in to change notification settings - Fork 105
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
How I can Desfire authenticate in two steps? #87
Comments
Could you please provide source code for this section ? |
Hi @SloCompTech
I think is not possible use libfreefare authenticate function with a external generate key. I'm going to modify the function to divide it into two phases. The only question I have is when should I make calls to |
As far as I understand authentication with Mifare Desfire you need to authenticate with application key after you select app, additionaly you authenticate with PICC key before you create, delete app, so I assume authentication needs to be preformed once, but I'm not 100% positive. |
@crossmax I think this is currently not supported but would be an interesting contribution (i have never worked with a SAM, all devices I had had no SAM)! The libfreefare/libfreefare/mifare_desfire.c Lines 350 to 434 in c18f702
I think that if you split this function into smaller pieces, a lot of code could be shared between authenticating with a MifrareDESFireKey and against a SAM module. Before starting this, you may want to be sure that if the communication is fully maced / encrypted, not every command has to pass through the SAM… If it is the case, I guess that updating the ugly |
@smortex I was doing what you said and two steps authentication works nice. Are this times normal? With other hardware and the same Desfire cards but using NXP native commands I was getting times almost twice as fast. |
@crossmax which bus are you using ? I2C ? SPI ? UART ? |
@SloCompTech I'm using SPI |
In connection string you can set speed, |
Yes. I checked the settings first of all. Up to 3,5MHz works fine but reading speed is still slow |
Hi! For debugging timing problems, I usually end-up using DTrace (I mainly run FreeBSD). If you are running on GNU/Linux, I guess that looking into this (super-complete, by some NetFlix staff) or this (same tools, in a TL;DR fashion) can help? This should help you to measure which step is slow… processing data, sending it to the device, reading, etc. |
Hi,
According to these traces everything is fine.
|
DTrace will not be available on Linux, but with gperf you should be able to gather information about where time is spent (e.g. your application; libfreefare; libnfc; or the kernel itself). Once you have measured which part is slow, you will know where to see if it's possible to improve this. |
Hi.
I'm trying authenticate on mifare desfire EV1 with a key generating for a external device (SAM module).
For that, in my old code where I used native commands, I send 0x0A command to PICC, and I get a random number within response. With this number, the SAM generates the key, and I send 0xAF command and 16 bytes for the key to resume authentication with the PICC.
With libfreefare functions, I don't know how to authenticate in two steps.
The output debug using libfreefare is as follows but I need to have control of the two steps of authentication:
How I can do it? Thanks
The text was updated successfully, but these errors were encountered: