opencard.opt.terminal
Class ISOCommandAPDU
java.lang.Object
|
+--opencard.core.terminal.APDU
|
+--opencard.core.terminal.CommandAPDU
|
+--opencard.opt.terminal.ISOCommandAPDU
- public class ISOCommandAPDU
- extends CommandAPDU
|
Field Summary |
static int |
CASE_1
Constants for the 7 cases of ISO CommandAPDUs |
static int |
CASE_2E
|
static int |
CASE_2S
|
static int |
CASE_3E
|
static int |
CASE_3S
|
static int |
CASE_4E
|
static int |
CASE_4S
|
static int |
CLASS
Constants for addressing in the APDU header array. |
static int |
INSTRUCTION
|
protected int |
lc
The length of the data field of the APDU. |
protected int |
le
The expected length of the ResponseAPDU. |
static int |
P1
|
static int |
P2
|
|
Constructor Summary |
ISOCommandAPDU(byte classByte,
byte instruction,
byte p1,
byte p2)
Constructs a new ISO command APDU (ISO 7816-4 CASE 1). |
ISOCommandAPDU(byte classByte,
byte instruction,
byte p1,
byte p2,
byte[] data)
Constructs a new ISO command APDU (ISO 7816-4 CASE 3). |
ISOCommandAPDU(byte classByte,
byte instruction,
byte p1,
byte p2,
byte[] data,
int le)
Constructs a new ISO command APDU (ISO 7816-4 CASE 4). |
ISOCommandAPDU(byte classByte,
byte instruction,
byte p1,
byte p2,
int le)
Constructs a new ISO command APDU (ISO 7816-4 CASE 2). |
ISOCommandAPDU(int size,
byte classByte,
byte instruction,
byte p1,
byte p2)
Constructs a new ISO command APDU (ISO 7816-4 CASE 1). |
ISOCommandAPDU(int size,
byte classByte,
byte instruction,
byte p1,
byte p2,
byte[] data)
Constructs a new ISO command APDU (ISO 7816-4 CASE 3). |
ISOCommandAPDU(int size,
byte classByte,
byte instruction,
byte p1,
byte p2,
byte[] data,
int le)
Constructs a new ISO command APDU (ISO 7816-4 CASE 4). |
ISOCommandAPDU(int size,
byte classByte,
byte instruction,
byte p1,
byte p2,
int le)
Constructs a new ISO command APDU (ISO 7816-4 CASE 2). |
|
Method Summary |
void |
append(byte b)
Appends the given byte to the buffered APDU. |
void |
append(byte[] bytes)
Appends the given byte array to the data field of the APDU. |
byte |
getCLA()
Gets the class byte. |
byte |
getINS()
Gets the instruction byte. |
int |
getIsoCase()
Gets the CASE of this ISOCommandAPDU. |
int |
getLC()
Gets the length lc of the data. |
int |
getLE()
Gets the expected length le of the response APDU. |
byte |
getP1()
Gets the P1 byte. |
byte |
getP2()
Gets the P2 byte. |
java.lang.String |
toString()
Gets a string representation of this APDU. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
lc
protected int lc
- The length of the data field of the APDU.
le
protected int le
- The expected length of the ResponseAPDU.
CASE_1
public static final int CASE_1
- Constants for the 7 cases of ISO CommandAPDUs
CASE_2S
public static final int CASE_2S
CASE_2E
public static final int CASE_2E
CASE_3S
public static final int CASE_3S
CASE_3E
public static final int CASE_3E
CASE_4S
public static final int CASE_4S
CASE_4E
public static final int CASE_4E
CLASS
public static final int CLASS
- Constants for addressing in the APDU header array.
INSTRUCTION
public static final int INSTRUCTION
P1
public static final int P1
P2
public static final int P2
ISOCommandAPDU
public ISOCommandAPDU(byte classByte,
byte instruction,
byte p1,
byte p2)
- Constructs a new ISO command APDU (ISO 7816-4 CASE 1).
- Parameters:
class - The CLA byte as specfied in ISO 7816-4.instruction - The INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.
ISOCommandAPDU
public ISOCommandAPDU(int size,
byte classByte,
byte instruction,
byte p1,
byte p2)
- Constructs a new ISO command APDU (ISO 7816-4 CASE 1).
- Parameters:
size - the size of the APDU buffer to createclass - The CLA byte as specfied in ISO 7816-4.instruction - The INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.
ISOCommandAPDU
public ISOCommandAPDU(byte classByte,
byte instruction,
byte p1,
byte p2,
int le)
- Constructs a new ISO command APDU (ISO 7816-4 CASE 2).
- Parameters:
class - The CLA byte as specfied in ISO 7816-4.instruction - The INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.le - An integer value giving the expected length of the response APDU.
This value can be in the range of -1 to 65536, where -1 means no
length is expected and 0 means the maximum length supported
is expected.
ISOCommandAPDU
public ISOCommandAPDU(int size,
byte classByte,
byte instruction,
byte p1,
byte p2,
int le)
- Constructs a new ISO command APDU (ISO 7816-4 CASE 2).
- Parameters:
size - the size of the APDU buffer to createclass - The CLA byte as specfied in ISO 7816-4.instruction - The INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.le - An integer value giving the expected length of the response APDU.
This value can be in the range of -1 to 65536, where -1 means no
length is expected and 0 means the maximum length supported
is expected.
ISOCommandAPDU
public ISOCommandAPDU(byte classByte,
byte instruction,
byte p1,
byte p2,
byte[] data)
- Constructs a new ISO command APDU (ISO 7816-4 CASE 3).
- Parameters:
class - The CLA byte as specfied in ISO 7816-4.instruction - The INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.data - The command APDU data as a byte array. The length lc (which is
part of the body of the APDU) is derived from the array length.
ISOCommandAPDU
public ISOCommandAPDU(int size,
byte classByte,
byte instruction,
byte p1,
byte p2,
byte[] data)
- Constructs a new ISO command APDU (ISO 7816-4 CASE 3).
- Parameters:
size - the size of the APDU buffer to createclass - The CLA byte as specfied in ISO 7816-4.instruction - The INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.data - The command APDU data as a byte array. The length lc (which is
part of the body of the APDU) is derived from the array length.
ISOCommandAPDU
public ISOCommandAPDU(byte classByte,
byte instruction,
byte p1,
byte p2,
byte[] data,
int le)
- Constructs a new ISO command APDU (ISO 7816-4 CASE 4).
- Parameters:
class - The CLA byte as specfied in ISO 7816-4.instruction - The INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.data - The command APDU data as a byte array. The length lc (which is
part of the body of the APDU) is derived from the array length.le - An integer value giving the expected length of the response APDU.
This value can be in the range of -1 to 65536, where -1 means no
length is expected and 0 means the maximum length supported
is expected.
ISOCommandAPDU
public ISOCommandAPDU(int size,
byte classByte,
byte instruction,
byte p1,
byte p2,
byte[] data,
int le)
- Constructs a new ISO command APDU (ISO 7816-4 CASE 4).
- Parameters:
size - the size of the APDU buffer to createclass - The CLA byte as specfied in ISO 7816-4.instruction - The INS byte.p1 - Parameter byte P1.p2 - Parameter byte P2.data - The command APDU data as a byte array. The length lc (which is
part of the body of the APDU) is derived from the array length.le - An integer value giving the expected length of the response APDU.
This value can be in the range of -1 to 65536, where -1 means no
length is expected and 0 means the maximum length supported
is expected.
getCLA
public byte getCLA()
- Gets the class byte.
- Returns:
- Class byte of the APDU.
getINS
public byte getINS()
- Gets the instruction byte.
- Returns:
- A byte value.
getP1
public byte getP1()
- Gets the P1 byte.
- Returns:
- A byte value.
getP2
public byte getP2()
- Gets the P2 byte.
- Returns:
- A byte value.
getLC
public int getLC()
- Gets the length lc of the data.
- Returns:
- An integer value giving the length. The value 0
indicates that there is no body.
getLE
public int getLE()
- Gets the expected length le of the response APDU.
- Returns:
- An integer value giving the length. The value -1
indicates that no value is specified.
getIsoCase
public int getIsoCase()
- Gets the CASE of this ISOCommandAPDU. ISO 7816-4
distinguishes 7 cases. In addition, coding can be proprietary (e.g.,
in the context of secure messaging).
- Case_1: CLA INS P1 P2
- Case_2S/E: CLA INS P1 P2 Le (short/extended)
- Case_3S/E: CLA INS P1 P2 Lc Data (short/extended)
- Case_4S/E: CLA INS P1 P2 Lc Data Le (short/extended)
- Returns:
- An integer value indicating the case.
append
public void append(byte[] bytes)
throws java.lang.IndexOutOfBoundsException
- Appends the given byte array to the data field of the APDU.
- Parameters:
bytes - the byte array to be appended- Throws:
- java.lang.IndexOutOfBoundsException - The buffer size is exceeded or a le exists in buffer.
- Overrides:
- append in class APDU
append
public void append(byte b)
throws java.lang.IndexOutOfBoundsException
- Appends the given byte to the buffered APDU.
- Parameters:
b - the byte to be appended- Returns:
- this IBMCommandAPDU
- Throws:
- java.lang.IndexOutOfBoundsException - The buffer size is exceeded or a le exists in buffer.
- Overrides:
- append in class APDU
toString
public java.lang.String toString()
- Gets a string representation of this APDU.
- Returns:
- A string describing this APDU.
NOTE: For non-ISO conform Command APDU's
the body of the Command APDU is not formatted. - Overrides:
- toString in class APDU
|