Use READ BINARY to read more than 256 bytes

后端 未结 5 2102
小鲜肉
小鲜肉 2020-12-10 15:40

I am trying to read a smartcard(German Gesundheitskarte) using javax.smartcardio

In the definition of the EF \"PD\" its length is specified as 850 bytes. The conten

5条回答
  •  佛祖请我去吃肉
    2020-12-10 16:20

    I tried the above exemple to read the DG2 file of a passport, but at the end, i was unable to get the image file. here is what i did in kotlin:

    do {
                val offsetStart = (offset shr 8) and 0xFF
                val offsetEnd = offset and 0xFF
    
                LogUtils.d(offsetStart)
                LogUtils.d(offsetEnd)
                var offsetStartString = if(offsetStart < 10){
                    "0$offsetStart"
                }else {
                    "$offsetStart"
                }
                val offsetEndString = if(offsetEnd < 10){
                    "0$offsetEnd"
                }else {
                    "$offsetEnd"
                }
                LogUtils.d(offsetStartString)
                LogUtils.d("00B0${offsetStartString}${offsetEndString}00")
                val commandByte = toByteArray("00B0${offsetStartString}${offsetEndString}00")
                resultCommand = this.nfc.transmit(commandByte,commandByte.size)
                val resultHex = StringUtil.toHexString(resultCommand)
                LogUtils.d(resultHex)
                baos.write(resultCommand)
                offset += 1
                LogUtils.d(resultCommand.size)
            } while (resultCommand.size > 4)
    

提交回复
热议问题