SmartCardTransport

class SmartCardTransport @JvmOverloads constructor(channel: CardChannel, val supportsExtendedLength: Boolean = false) : ApduTransport, AutoCloseable

Sends APDUs through a connected PC/SC card channel.

The command bytes and response bytes pass through unchanged. This transport does not inspect chip data or decide whether a response is trustworthy. It owns the connected card session: close disconnects the card without requesting a reset.

PC/SC readers often support extended-length APDUs, but support depends on the reader, driver and card. Set supportsExtendedLength to true only when the reader path is known to carry them. The default is conservative and reports short APDUs only.

Blocking PC/SC calls run on the calling thread, including inside transceive.

Experimental: see ExperimentalTesseraChipApi.

Since

1.0.0

Constructors

Link copied to clipboard
constructor(channel: CardChannel, supportsExtendedLength: Boolean = false)

Properties

Link copied to clipboard
open override val maxCommandLength: Int

The longest command APDU this transport reports it can send, in bytes.

Link copied to clipboard
Link copied to clipboard
open override val supportsExtendedLength: Boolean

Whether this reader path is known to carry extended APDUs.

Functions

Link copied to clipboard
open override fun close()

Disconnects the card without asking the reader to reset it.

Link copied to clipboard
open suspend override fun transceive(command: ByteArray): ByteArray

Sends one command APDU and returns the card's response bytes, including the status word.