'mifare 4k classic write does not work as expected

I want to write to a mifare classic 4k, using the following APDU command (UPDATE BINARY):

APDU = {FF D6 00 20 10 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0Fh}

It seems fine as a get a 90 00 result... but when i read the card back I always got the following (even with different data...):

sector: 8 (block 32), auth OK
032: D5 41 00 EA 00 FF 13 3E 86 6A 00 00 00 00 69 FF
033: D5 41 00 EA 00 FF 13 3E 86 6A 00 00 00 00 69 FF
034: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
035: 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF

where does this string D5 41 00 EA 00 FF 13 3E 86 6A 00 00 00 00 69 FF come from?

Note that i didn't change any setting on the card and was properly authenticated. It was a blank card and i didn't touch the trailer.

I m using a ACR122 reader (this command comes direct from the documentation of the reader...)



Solution 1:[1]

Ok i found my problem, i was setting the wrong size for the cbSendLength parameter in SCardTransmit.

Now i set the correct one (the whole size of the APDU command: 21) and it works fine.

Sorry.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fred