Package org.eclipse.keyple.core.util
Class ApduUtil
- java.lang.Object
-
- org.eclipse.keyple.core.util.ApduUtil
-
public final class ApduUtil extends java.lang.Object
Util to build APDUs and check case 4.- Since:
- 2.0.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
build(byte cla, byte ins, byte p1, byte p2, byte[] dataIn, java.lang.Byte le)
Builds an APDU request from its elements as defined by the ISO 7816 standard.static boolean
isCase4(byte[] apduCommand)
Indicates if the provided byte array contains a case4 APDU command.
-
-
-
Method Detail
-
build
public static byte[] build(byte cla, byte ins, byte p1, byte p2, byte[] dataIn, java.lang.Byte le)
Builds an APDU request from its elements as defined by the ISO 7816 standard.- Parameters:
cla
- The class byte.ins
- The instruction byte.p1
- The parameter 1.p2
- The parameter 2.dataIn
- The data field of the command (optional). If empty, then LC will be set to 0.le
- The maximum number of bytes expected in the data field of the response to the command (optional).- Returns:
- A byte array containing the resulting apdu command data.
- Since:
- 2.0.0
-
isCase4
public static boolean isCase4(byte[] apduCommand)
Indicates if the provided byte array contains a case4 APDU command.The ISO7816 case for data in a command-response pair is determined from the provided arguments:
dataIn = null, le = null
→ case 1: no command data, no response data expected.dataIn = null, le != null
→ case 2: no command data, expected response data.dataIn != null, le = null
→ case 3: command data, no response data expected.dataIn != null, le = 0
→ case 4: command data, expected response data.
In this case (incoming and outgoing data for the card), Le is set to 0, letting the lower layer (see API plugin) take care of recovering the exact length of the outgoing data.- Parameters:
apduCommand
- The apduCommand to check.- Returns:
- true the APDU command is case 4.
- Since:
- 2.0.0
-
-