I am attempting to write to a MIFARE DESFire Light card using the Write Data command in ISO/IEC 7816 APDU Wrapping and native chaining. The card has a Standard File of size 256. I'm attempting to write exactly 256 bytes but I keep getting a response of "0x917E - Length of command string invalid". I've attempted to make the frame different sizes but that does not help. The datasheet says the card has a frame size of 128 bytes by default; but I still get the same error, so that cannot be the issue.
I tried writing just 7 bytes and that works, so the issue must be length parameter (3 bytes - little endian). If the file size is 256 I should be able to write 256 bytes, no? So, the length parameter should be 00 01 00.
Here's a byte view of the first frame that I'm sending to the card:
C-APDU --> 90 8D 00 00 71 00 00 00 00 00 01 00 |--- 87 bytes of data ---| 00
R-APDU <-- 91 7E