All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.binaryfoo.decoders.apdu.GetDataAPDUDecoder.kt Maven / Gradle / Ivy

There is a newer version: 0.1.8
Show newest version
package io.github.binaryfoo.decoders.apdu

import io.github.binaryfoo.DecodedData
import io.github.binaryfoo.decoders.DecodeSession
import io.github.binaryfoo.tlv.Tag
import kotlin.text.substring

class GetDataAPDUDecoder : CommandAPDUDecoder {
    override fun getCommand(): APDUCommand {
        return APDUCommand.GetData
    }

    override fun decode(input: String, startIndexInBytes: Int, session: DecodeSession): DecodedData {
        val tagHex = input.substring(4, 8)
        val tag = Tag.fromHex(tagHex)
        return DecodedData(null, "C-APDU: GetData", tag.toString(session.tagMetaData!!), startIndexInBytes, startIndexInBytes + 5)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy