Interface ApduInterpreterSpi
Its implementation is provided by ApduInterpreterFactorySpi.
Upon calling processApdu, implementations determine how to invoke the appropriate
methods of CommandProcessorApi based on the card type.
For standard ISO 7816-4 APDUs, the interpreter directly calls CommandProcessorApi.transmitIsoApdu(byte[]). For storage-type cards, the interpreter translates
the APDU into specific read/write operations using CommandProcessorApi.getUID(), CommandProcessorApi.readBlock(int, int) and CommandProcessorApi.writeBlock(int, byte[]).
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]processApdu(byte[] apdu) Processes an APDU command by invoking the corresponding methods ofCommandProcessorApibased on the card type.voidsetCommandProcessor(CommandProcessorApi commandProcessor) Sets the command processor responsible for handling APDU execution.
-
Method Details
-
setCommandProcessor
Sets the command processor responsible for handling APDU execution.- Parameters:
commandProcessor- TheCommandProcessorApiinstance used for APDU communication.- Since:
- 1.0.0
-
processApdu
Processes an APDU command by invoking the corresponding methods ofCommandProcessorApibased on the card type.If the card supports standard ISO 7816-4 APDUs, this method calls
CommandProcessorApi.transmitIsoApdu(byte[]). Otherwise, it interprets the APDU and executes the required read or write operations throughCommandProcessorApi.readBlock(int, int)orCommandProcessorApi.writeBlock(int, byte[]).- Parameters:
apdu- The APDU command as a byte array.- Returns:
- The response as a byte array.
- Throws:
IllegalArgumentException- if the APDU is null or invalid.Exception- if the transmission fails or a communication error occurs.- Since:
- 1.0.0
-