public final class APDU extends Object
This class only supports messages which conform to the structure of command
and response defined in ISO 7816-4. The behavior of messages which use
proprietary structure of messages is undefined. This class optionally
supports extended length fields but only when the currently selected applet
implements the javacardx.apdu.ExtendedLength
interface.
The APDU
object is owned by the Java Card runtime environment.
The APDU
class maintains a byte array buffer which is used to
transfer incoming APDU header and data bytes as well as outgoing data. The
buffer length must be at least 133 bytes ( 5 bytes of header and 128 bytes of
data ). The Java Card runtime environment must zero out the APDU buffer
before each new message received from the CAD.
The Java Card runtime environment designates the APDU
object
as a temporary Java Card runtime environment Entry Point Object (See
Runtime Environment
Specification, Java Card Platform, Classic Edition,
section 6.2.1 for details). A temporary Java Card runtime environment Entry
Point Object can be accessed from any applet context. References to these
temporary objects cannot be stored in class variables or instance variables
or array components.
The Java Card runtime environment similarly marks the APDU buffer as a global array (See Runtime Environment Specification, Java Card Platform, Classic Edition, section 6.2.2 for details). A global array can be accessed from any applet context. References to global arrays cannot be stored in class variables or instance variables or array components.
The applet receives the APDU
instance to process from the Java
Card runtime environment in the Applet.process(APDU)
method,
and the first five header bytes [ CLA, INS, P1, P2, P3 ] are available in the
APDU buffer. (The header format is the ISO7816-4 defined 7 byte extended APDU
format with a 3 byte Lc field when the Lc field in the incoming APDU header
is 3 bytes long).
The APDU
class API is designed to be transport protocol
independent. In other words, applets can use the same APDU methods regardless
of whether the underlying protocol in use is T=0 or T=1 (as defined in ISO
7816-3).
The incoming APDU data size may be bigger than the APDU buffer size and may
therefore need to be read in portions by the applet. Similarly, the outgoing
response APDU data size may be bigger than the APDU buffer size and may need
to be written in portions by the applet. The APDU
class has
methods to facilitate this.
For sending large byte arrays as response data, the APDU
class
provides a special method sendBytesLong()
which manages the
APDU buffer.
// The purpose of this example is to show most of the methods // in use and not to depict any particular APDU processing class MyApplet extends javacard.framework.Applet { // ... public void process(APDU apdu){ // ... byte[] buffer = apdu.getBuffer(); byte cla = buffer[ISO7816.OFFSET_CLA]; byte ins = buffer[ISO7816.OFFSET_INS]; ... // assume this command has incoming data // Lc tells us the incoming apdu command length short bytesLeft = (short) (buffer[ISO7816.OFFSET_LC] & 0x00FF); if (bytesLeft < (short)55) ISOException.throwIt( ISO7816.SW_WRONG_LENGTH ); short readCount = apdu.setIncomingAndReceive(); while ( bytesLeft > 0){ // enter code here to process the data previously read in buffer[5] // to buffer[readCount+4]; bytesLeft -= readCount; readCount = apdu.receiveBytes ( ISO7816.OFFSET_CDATA ); // read more APDU data } // //... // // Note that for a short response as in the case illustrated here // the three APDU method calls shown : setOutgoing(),setOutgoingLength() & sendBytes() // could be replaced by one APDU method call : setOutgoingAndSend(). // construct the reply APDU short le = apdu.setOutgoing(); if (le < (short)2) ISOException.throwIt( ISO7816.SW_WRONG_LENGTH ); apdu.setOutgoingLength( (short)3 ); // build response data in apdu.buffer[ 0.. outCount-1 ]; buffer[0] = (byte)1; buffer[1] = (byte)2; buffer[3] = (byte)3; apdu.sendBytes ( (short)0 , (short)3 ); // return good complete status 90 00 } // ... }The
APDU
class also defines a set of STATE_..
constants which represent the various processing states of the
APDU
object based on the methods invoked and the state of the
data transfers. The getCurrentState()
method returns the
current state.
Note that the state number assignments are ordered as follows: STATE_INITIAL < STATE_PARTIAL_INCOMING < STATE_FULL_INCOMING < STATE_OUTGOING < STATE_OUTGOING_LENGTH_KNOWN < STATE_PARTIAL_OUTGOING < STATE_FULL_OUTGOING.
The following are processing error states and have negative state number assignments : STATE_ERROR_NO_T0_GETRESPONSE, STATE_ERROR_T1_IFD_ABORT, STATE_ERROR_IO and STATE_ERROR_NO_T0_REISSUE.
Note:
APDUException
,
ISOException
Modifier and Type | Field and Description |
---|---|
static byte |
PROTOCOL_MEDIA_CONTACTLESS_TYPE_A
Transport protocol Media - Contactless Type A
|
static byte |
PROTOCOL_MEDIA_CONTACTLESS_TYPE_B
Transport protocol Media - Contactless Type B
|
static byte |
PROTOCOL_MEDIA_CONTACTLESS_TYPE_F
JIS X 6319-4:2010 transport protocol Type F
|
static byte |
PROTOCOL_MEDIA_DEFAULT
Transport protocol Media - Contacted Asynchronous Half Duplex
|
static byte |
PROTOCOL_MEDIA_HCI_APDU_GATE
Transport protocol Media - APDU over HCI defined for the APDU gate in ETSI TS 102 622
|
static byte |
PROTOCOL_MEDIA_MASK
Media nibble mask in protocol byte
|
static byte |
PROTOCOL_MEDIA_USB
Transport protocol Media - USB
|
static byte |
PROTOCOL_T0
ISO 7816 transport protocol type T=0.
|
static byte |
PROTOCOL_T1
ISO 7816 transport protocol type T=1.
|
static byte |
PROTOCOL_TYPE_MASK
Type nibble mask in protocol byte
|
static byte |
STATE_ERROR_IO
This error state of a
APDU object occurs when an
APDUException with reason code
APDUException.IO_ERROR has been thrown. |
static byte |
STATE_ERROR_NO_T0_GETRESPONSE
This error state of a
APDU object occurs when an
APDUException with reason code
APDUException.NO_T0_GETRESPONSE has been thrown. |
static byte |
STATE_ERROR_NO_T0_REISSUE
This error state of a
APDU object occurs when an
APDUException with reason code
APDUException.NO_T0_REISSUE has been thrown. |
static byte |
STATE_ERROR_T1_IFD_ABORT
This error state of a
APDU object occurs when an
APDUException with reason code
APDUException.T1_IFD_ABORT has been thrown. |
static byte |
STATE_FULL_INCOMING
This is the state of a
APDU object when all the incoming
data been received. |
static byte |
STATE_FULL_OUTGOING
This is the state of a
APDU object when all outbound data
has been transferred. |
static byte |
STATE_INITIAL
This is the state of a new
APDU object when only the
command header is valid. |
static byte |
STATE_OUTGOING
This is the state of a new
APDU object when data transfer
mode is outbound but length is not yet known. |
static byte |
STATE_OUTGOING_LENGTH_KNOWN
This is the state of a
APDU object when data transfer mode
is outbound and outbound length is known. |
static byte |
STATE_PARTIAL_INCOMING
This is the state of a
APDU object when incoming data has
partially been received. |
static byte |
STATE_PARTIAL_OUTGOING
This is the state of a
APDU object when some outbound data
has been transferred but not all. |
Modifier and Type | Method and Description |
---|---|
byte[] |
getBuffer()
Returns the APDU buffer byte array.
|
static byte |
getCLAChannel()
Returns the logical channel number associated with the current
APDU command based on the CLA byte. |
static APDU |
getCurrentAPDU()
This method is called during the
Applet.process(APDU)
method to obtain a reference to the current APDU object. |
static byte[] |
getCurrentAPDUBuffer()
This method is called during the
Applet.process(APDU)
method to obtain a reference to the current APDU buffer. |
byte |
getCurrentState()
This method returns the current processing state of the
APDU
object. |
static short |
getInBlockSize()
Returns the configured incoming block size.
|
short |
getIncomingLength()
Returns the incoming data length(Lc).
|
byte |
getNAD()
Returns the Node Address byte (NAD) in contacted T=1 protocol, and 0
in contacted T=0 and contactless protocols.
|
short |
getOffsetCdata()
Returns the offset within the APDU buffer for incoming command data.
|
static short |
getOutBlockSize()
Returns the configured outgoing block size.
|
static byte |
getProtocol()
Returns the ISO 7816 transport protocol type, T=1 or T=0, in the low
nibble and the transport media in the upper nibble in use, based on
protocol and media used for the last APDU received.
|
boolean |
isCommandChainingCLA()
Returns whether the current
APDU command is the first or
part of a command chain. |
boolean |
isISOInterindustryCLA()
Returns whether the current
APDU command CLA byte
corresponds to an interindustry command as defined in ISO 7816-4:2013
specification. |
boolean |
isSecureMessagingCLA()
Returns
true if the encoding of the current
APDU command based on the CLA byte indicates secure
messaging. |
boolean |
isValidCLA()
Returns whether the current
APDU command CLA byte is
valid. |
short |
receiveBytes(short bOff)
Gets as many data bytes as will fit without APDU buffer overflow, at the
specified offset
bOff . |
void |
sendBytes(short bOff,
short len)
Sends
len more bytes from APDU buffer at specified offset
bOff . |
void |
sendBytesLong(byte[] outData,
short bOff,
short len)
Sends
len more bytes from outData byte
array starting at specified offset bOff . |
short |
setIncomingAndReceive()
This is the primary receive method.
|
short |
setOutgoing()
This method is used to set the data transfer direction to outbound and to
obtain the expected length of response (Ne).
|
void |
setOutgoingAndSend(short bOff,
short len)
This is the "convenience" send method.
|
void |
setOutgoingLength(short len)
Sets the actual length of response data.
|
short |
setOutgoingNoChaining()
This method is used to set the data transfer direction to outbound
without using chaining mode and to obtain the
expected length of response (Ne).
|
static void |
waitExtension()
Requests additional processing time from CAD.
|
public static final byte STATE_INITIAL
APDU
object when only the
command header is valid.public static final byte STATE_PARTIAL_INCOMING
APDU
object when incoming data has
partially been received.public static final byte STATE_FULL_INCOMING
APDU
object when all the incoming
data been received.public static final byte STATE_OUTGOING
APDU
object when data transfer
mode is outbound but length is not yet known.public static final byte STATE_OUTGOING_LENGTH_KNOWN
APDU
object when data transfer mode
is outbound and outbound length is known.public static final byte STATE_PARTIAL_OUTGOING
APDU
object when some outbound data
has been transferred but not all.public static final byte STATE_FULL_OUTGOING
APDU
object when all outbound data
has been transferred.public static final byte STATE_ERROR_NO_T0_GETRESPONSE
APDU
object occurs when an
APDUException
with reason code
APDUException.NO_T0_GETRESPONSE
has been thrown.public static final byte STATE_ERROR_T1_IFD_ABORT
APDU
object occurs when an
APDUException
with reason code
APDUException.T1_IFD_ABORT
has been thrown.public static final byte STATE_ERROR_IO
APDU
object occurs when an
APDUException
with reason code
APDUException.IO_ERROR
has been thrown.public static final byte STATE_ERROR_NO_T0_REISSUE
APDU
object occurs when an
APDUException
with reason code
APDUException.NO_T0_REISSUE
has been thrown.public static final byte PROTOCOL_MEDIA_MASK
public static final byte PROTOCOL_TYPE_MASK
public static final byte PROTOCOL_T0
public static final byte PROTOCOL_T1
public static final byte PROTOCOL_MEDIA_DEFAULT
public static final byte PROTOCOL_MEDIA_CONTACTLESS_TYPE_A
public static final byte PROTOCOL_MEDIA_CONTACTLESS_TYPE_B
public static final byte PROTOCOL_MEDIA_USB
public static final byte PROTOCOL_MEDIA_HCI_APDU_GATE
public static final byte PROTOCOL_MEDIA_CONTACTLESS_TYPE_F
public byte[] getBuffer()
Note:
public static short getInBlockSize()
This information may be used to ensure that there is enough space
remaining in the APDU buffer when receiveBytes()
is
invoked.
Note:
receiveBytes()
the bOff
param
should account for this potential blocksize.
receiveBytes(short)
public static short getOutBlockSize()
This information may be used prior to invoking the
setOutgoingLength()
method, to limit the length of
outgoing messages when chaining mode is not allowed.
See Runtime Environment
Specification, Java Card Platform, Classic Edition,
section 9.4 for details.
Note:
setOutgoingLength()
the len
param
should account for this potential blocksize.
setOutgoingLength(short)
public static byte getProtocol()
Note:
PROTOCOL_*
constants above, for example
PROTOCOL_T0
.public byte getNAD()
public short setOutgoing() throws APDUException, ISOException
Notes.
setIncomingAndReceive()
must
be invoked prior to calling this method. Otherwise, erroneous
behavior may result in T=0 protocol.
javacardx.apdu.ExtendedLength
interface.
javacardx.apdu.ExtendedLength
interface.
APDU
object to
STATE_OUTGOING
.
APDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if this
method, or setOutgoingNoChaining()
method
already invoked.
APDUException.IO_ERROR
if the APDU is
an error state.
ISOException
public short setOutgoingNoChaining() throws APDUException, ISOException
setOutgoing()
method by applets which need to be
compatible with legacy CAD/terminals which do not support
chaining mode. See Runtime Environment
Specification, Java Card Platform, Classic Edition,
section 9.4 for details.
Notes.
setIncomingAndReceive()
must
be invoked prior to calling this method. Otherwise, erroneous
behavior may result in T=0 protocol.
javacardx.apdu.ExtendedLength
interface.
waitExtension()
method cannot be used.
(ISO7816.SW_BYTES_REMAINING_00+count)
response status chaining.
See the Runtime Environment Specification, Java Card Platform, Classic Edition, section 9.4 for details.
APDU
object to
STATE_OUTGOING
.
APDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if this
method, or setOutgoing()
method already
invoked.
APDUException.IO_ERROR
if the APDU is
in an error state
ISOException
public void setOutgoingLength(short len) throws APDUException
0
is specified, no data will be output.
Note:
APDU
object to
STATE_OUTGOING_LENGTH_KNOWN
.
len
- the length of response dataAPDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if
setOutgoing()
or
setOutgoingNoChaining()
not called or if
setOutgoingAndSend()
already invoked, or
this method already invoked.
APDUException.BAD_LENGTH
if any one of
the following is true:
len
is negative.len
is greater than 256 and the
currently selected applet does not implement the
javacardx.apdu.ExtendedLength
interface.len
is greater
than 256.len
is greater
than (IFSD-2), where IFSD is the Outgoing Block Size. The
-2 accounts for the status bytes in T=1.APDUException.NO_T0_GETRESPONSE
if T=0
protocol is in use and the CAD does not respond to
(ISO7816.SW_BYTES_REMAINING_00+count)
response status with GET RESPONSE command on the same
origin logical channel number as that of the current APDU
command.
APDUException.NO_T0_REISSUE
if T=0
protocol is in use and the CAD does not respond to
(ISO7816.SW_CORRECT_LENGTH_00+count)
response status by re-issuing same APDU command on the
same origin logical channel number as that of the current
APDU command with the corrected length.
APDUException.IO_ERROR
if the APDU is
in an error state
getOutBlockSize()
public short receiveBytes(short bOff) throws APDUException
bOff
. Gets all the remaining bytes if
they fit.
Notes:
APDUException
with T1_IFD_ABORT
reason code, the Java Card runtime environment will restart APDU command processing using the newly
received command. No more input data can be received.
No output data can be transmitted. No error status response can be returned.
APDU
object to
STATE_PARTIAL_INCOMING
if all incoming bytes are not received.
APDU
object to
STATE_FULL_INCOMING
if all incoming bytes are received.
bOff
- the offset into APDU bufferAPDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if
setIncomingAndReceive()
not called or if
setOutgoing()
or
setOutgoingNoChaining()
previously invoked.
APDUException.BUFFER_BOUNDS
if not
enough buffer space for incoming block size or
if bOff
is negative.
APDUException.IO_ERROR
if the APDU is
in an error state
APDUException.T1_IFD_ABORT
if T=1
protocol is in use and the CAD sends in an ABORT S-Block
command to abort the data transfer.
getInBlockSize()
public short setIncomingAndReceive() throws APDUException
This method should only be called on a case 3 or case 4 command, otherwise erroneous behavior may result.
Notes:
receiveBytes(5)
for normal semantics or
receiveBytes(7)
for extended semantics.
Applet.process()
method.
APDU
object to
STATE_PARTIAL_INCOMING
if all incoming bytes are not received.
APDU
object to
STATE_FULL_INCOMING
if all incoming bytes are received.
APDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if
setIncomingAndReceive()
already invoked or
if setOutgoing()
or
setOutgoingNoChaining()
previously invoked.
APDUException.IO_ERROR
if the APDU is in
an error state
APDUException.T1_IFD_ABORT
if T=1
protocol is in use and the CAD sends in an ABORT S-Block
command to abort the data transfer.
getIncomingLength()
,
getOffsetCdata()
public void sendBytes(short bOff, short len) throws APDUException
len
more bytes from APDU buffer at specified offset
bOff
.
If the last part of the response is being sent by the invocation of this method, the APDU buffer must not be altered. If the data is altered, incorrect output may be sent to the CAD. Requiring that the buffer not be altered allows the implementation to reduce protocol overhead by transmitting the last part of the response along with the status bytes.
Notes:
setOutgoingNoChaining()
was invoked, output chaining mode must not be used.
See Runtime Environment Specification, Java Card Platform, Classic Edition section 9.4 for details.
setOutgoingNoChaining()
was invoked, Le bytes must be transmitted
before (ISO7816.SW_BYTES_REMAINING_00+remaining bytes)
response status is returned.
APDUException
with NO_T0_GETRESPONSE
or NO_T0_REISSUE
reason code,
the Java Card runtime environment will restart APDU command processing using the newly
received command. No more output data can be transmitted. No error status response can be returned.
APDUException
with T1_IFD_ABORT
reason code, the Java Card runtime environment will restart APDU command processing using the newly
received command. No more output data can be transmitted. No error status response can be returned.
APDU
object to
STATE_PARTIAL_OUTGOING
if all outgoing bytes have not been sent.
APDU
object to
STATE_FULL_OUTGOING
if all outgoing bytes have been sent.
bOff
- the offset into APDU bufferlen
- the length of the data in bytes to sendAPDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if
setOutgoingLength()
not called or
setOutgoingAndSend()
previously invoked or
response byte count exceeded or if
APDUException.NO_T0_GETRESPONSE
or
APDUException.NO_T0_REISSUE
or
APDUException.T1_IFD_ABORT
previously
thrown.
APDUException.BUFFER_BOUNDS
if
bOff
is negative or len
is
negative or bOff+len
exceeds the buffer
size.
APDUException.IO_ERROR
if the APDU is
in an error state.
APDUException.NO_T0_GETRESPONSE
if T=0
protocol is in use and the CAD does not respond to
(ISO7816.SW_BYTES_REMAINING_00+count)
response status with GET RESPONSE command on the same
origin logical channel number as that of the current APDU
command.
APDUException.NO_T0_REISSUE
if T=0
protocol is in use and the CAD does not respond to
(ISO7816.SW_CORRECT_LENGTH_00+count)
response status by re-issuing same APDU command on the
same origin logical channel number as that of the current
APDU command with the corrected length.
APDUException.T1_IFD_ABORT
if T=1
protocol is in use and the CAD sends in an ABORT S-Block
command to abort the data transfer.
setOutgoing()
,
setOutgoingNoChaining()
public void sendBytesLong(byte[] outData, short bOff, short len) throws APDUException, SecurityException
len
more bytes from outData
byte
array starting at specified offset bOff
.
If the last of the response is being sent by the invocation of this method, the APDU buffer must not be altered. If the data is altered, incorrect output may be sent to the CAD. Requiring that the buffer not be altered allows the implementation to reduce protocol overhead by transmitting the last part of the response along with the status bytes.
The Java Card runtime environment may use the APDU buffer to send data to the CAD.
Notes:
setOutgoingNoChaining()
was invoked, output chaining mode must not be used.
See Runtime Environment Specification, Java Card Platform, Classic Edition section 9.4 for details.
setOutgoingNoChaining()
was invoked, Le bytes must be transmitted
before (ISO7816.SW_BYTES_REMAINING_00+remaining bytes)
response status is returned.
APDUException
with
NO_T0_GETRESPONSE
or NO_T0_REISSUE
reason code,
the Java Card runtime environment will restart APDU command processing using the newly received command. No more output
data can be transmitted. No error status response can be returned.
APDUException
with T1_IFD_ABORT
reason code, the Java Card runtime environment will restart APDU command processing using the newly
received command. No more output data can be transmitted. No error status response can be returned.
APDU
object to
STATE_PARTIAL_OUTGOING
if all outgoing bytes have not been sent.
APDU
object to
STATE_FULL_OUTGOING
if all outgoing bytes have been sent.
outData
- the source data byte arraybOff
- the offset into OutData arraylen
- the byte length of the data to sendSecurityException
- if the outData
array is not accessible in
the caller's contextAPDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if
setOutgoingLength()
not called or
setOutgoingAndSend()
previously invoked or
response byte count exceeded or if
APDUException.NO_T0_GETRESPONSE
or
APDUException.NO_T0_REISSUE
or
APDUException.NO_T0_REISSUE
previously
thrown.
APDUException.IO_ERROR
if the APDU is
in an error state.
APDUException.NO_T0_GETRESPONSE
if T=0
protocol is in use and CAD does not respond to
(ISO7816.SW_BYTES_REMAINING_00+count)
response status with GET RESPONSE command on the same
origin logical channel number as that of the current APDU
command.
APDUException.T1_IFD_ABORT
if T=1
protocol is in use and the CAD sends in an ABORT S-Block
command to abort the data transfer.
setOutgoing()
,
setOutgoingNoChaining()
public void setOutgoingAndSend(short bOff, short len) throws APDUException
setOutgoing(), setOutgoingLength( len )
followed by
sendBytes ( bOff, len )
. In addition, once this method is
invoked, sendBytes()
and sendBytesLong()
methods cannot be invoked and the APDU buffer must not be altered.
Sends len
byte response from the APDU buffer starting at
the specified offset bOff
.
Notes:
APDU
send methods can be invoked.
Applet.process()
APDU
object to
STATE_FULL_OUTGOING
.
bOff
- the offset into APDU bufferlen
- the bytelength of the data to sendAPDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if
setOutgoing()
or
setOutgoingAndSend()
previously invoked.
APDUException.IO_ERROR
if the APDU is
in an error state.
APDUException.BAD_LENGTH
if
len
is negative or greater than 256 and the
currently selected applet does not implement the
javacardx.apdu.ExtendedLength
interface.
public byte getCurrentState()
APDU
object. It is used by the BasicService
class to help
services collaborate in the processing of an incoming APDU command. Valid
codes are listed in STATE_*
constants above, for example
STATE_INITIAL
.javacard.framework.service.BasicService
public static APDU getCurrentAPDU() throws SecurityException
Applet.process(APDU)
method to obtain a reference to the current APDU
object.
This method can only be called in the context of the currently selected
applet.
Note:
APDU
object being processedSecurityException
- if
public static byte[] getCurrentAPDUBuffer() throws SecurityException
Applet.process(APDU)
method to obtain a reference to the current APDU buffer. This method can
only be called in the context of the currently selected applet.
Note:
APDU
object and APDU buffer are reserved for use by RMIService
. Remote
method parameter data may become corrupted.
APDU
object being processedSecurityException
- if
public static byte getCLAChannel()
APDU
command based on the CLA byte. A number in the range
0-19 based on the CLA byte encoding is returned if the command contains
logical channel encoding. If the command does not contain logical channel
information, 0 is returned.
Note:
See Runtime Environment Specification, Java Card Platform, Classic Edition, section 4.3 for encoding details.
public static void waitExtension() throws APDUException
Notes:
APDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if
setOutgoingNoChaining()
previously invoked.
APDUException.IO_ERROR
if the APDU is in
an error state.
public boolean isCommandChainingCLA()
APDU
command is the first or
part of a command chain. Bit b5 of the CLA byte if set, indicates that
the APDU
is the first or part of a chain of commands.
Note:
false
if the CLA bits (b8,b7,b6) is
%b001 which is a CLA encoding reserved for future use(RFU),
or if CLA is 0xFF which is an invalid value as defined in
the ISO 7816-4:2013 specification.
See Runtime Environment Specification, Java Card Platform, Classic Edition, section 4.3 for encoding details.
true
if this APDU is not the last APDU of a
command chain, false
otherwise.public boolean isSecureMessagingCLA()
true
if the encoding of the current
APDU
command based on the CLA byte indicates secure
messaging. The secure messaging information is in bits (b4,b3) for
commands with origin channel numbers 0-3, and in bit b6 for origin
channel numbers 4-19.
Note:
false
if the CLA bits (b8,b7,b6) is
%b001 which is a CLA encoding reserved for future use(RFU),
or if CLA is 0xFF which is an invalid value as defined in
the ISO 7816-4:2013 specification.
See Runtime Environment Specification, Java Card Platform, Classic Edition, section 4.3 for encoding details.
true
if the secure messaging bit(s) is(are)
nonzero, false
otherwisepublic boolean isISOInterindustryCLA()
APDU
command CLA byte
corresponds to an interindustry command as defined in ISO 7816-4:2013
specification. Bit b8 of the CLA byte if 0
, indicates
that the APDU
is an interindustry command.true
if this APDU CLA byte corresponds to an ISO
interindustry command, false
otherwise.public boolean isValidCLA()
APDU
command CLA byte is
valid. The CLA byte is invalid if the CLA bits (b8,b7,b6) is %b001, which
is a CLA encoding reserved for future use(RFU), or if CLA is 0xFF which
is an invalid value as defined in the ISO 7816-4:2013 specification.
See Runtime Environment Specification, Java Card Platform, Classic Edition, section 4.3 for encoding details.
true
if this APDU CLA byte is valid,
false
otherwise.public short getIncomingLength()
0
if no incoming data (Case 1)APDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if
setIncomingAndReceive()
not called or if
setOutgoing()
or
setOutgoingNoChaining()
previously invoked.getOffsetCdata()
public short getOffsetCdata()
setIncomingAndReceive()
method. The value returned is either 5 (Lc is 1 byte), or 7 (when
Lc is 3 bytes)APDUException
- with the following reason codes:
APDUException.ILLEGAL_USE
if
setIncomingAndReceive()
not called or if
setOutgoing()
or
setOutgoingNoChaining()
previously invoked.getIncomingLength()
Copyright © 1998, 2015, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms