0

This question is with reference to the Mifare SDK TapLinx library usage.

val fs = desFireEV2.getFileSettings(0)

I can read the file's contents. But I need to know how to get the file's size. I am able to read the contents because I hardcoded the file's size in the readData() call.

I'm aware in the DESFire spec is 0xF5 to get file settings and the file's size is returned in 3 bytes. But in TapLinx provided library is not clear how to get the files's size.

daparic
  • 3,794
  • 2
  • 36
  • 38

1 Answers1

0

After tinkering for a while, I am able to find the proper way to get the file size using below Kotlin snippet:

val fs = desFireEV2.getFileSettings(0)
when (fs.type) {
    DESFireFile.FileType.DataStandard -> {
        val fileSize = (fs as StdDataFileSettings).fileSize
        println("fileSize = $fileSize")
    }
}

The reader.transceive(Utilities.stringToBytes("90F50000 010000") is also able to tell the file's size, but it has a nasty side-effect of resetting the authenticated state wherein I have to re-authenticate again to move on.

daparic
  • 3,794
  • 2
  • 36
  • 38