| 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 javacard.framework.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 object. |
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 T=1 protocol, and 0
in T=0 protocol.
|
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.
|
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:2005 specification. |
boolean |
isSecureMessagingCLA()
Returns
true if the encoding of the current
APDU
command based on the
CLA byte indicates secure messaging. |
short |
receiveBytes(short bOff) |
void |
sendBytes(short bOff,
short len) |
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 (Le).
|
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 BLOCK CHAINING (See ISO 7816-3/4) and to obtain the expected length of response (Le).
|
static void |
waitExtension()
Requests additional processing time from CAD.
|
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 BLOCK CHAINING is not allowed.
Note:
setOutgoingLength() the len param
should account for this potential blocksize.
setOutgoingLength(short)public static byte getProtocol()
PROTOCOL_T0public byte getNAD()
public short setOutgoing()
throws javacard.framework.APDUException
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.
javacard.framework.APDUException - with the following reason codes:APDUException.ILLEGAL_USE if this method, or setOutgoingNoChaining() method already invoked.
APDUException.IO_ERROR on I/O error.
public short setOutgoingNoChaining()
throws javacard.framework.APDUException
setOutgoing() method by applets which need
to be compatible with legacy CAD/terminals which do not support ISO 7816-3/4 defined block chaining.
See Runtime Environment
Specification for the Java Card Platform, 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.
APDU object to
STATE_OUTGOING.
javacard.framework.APDUException - with the following reason codes:APDUException.ILLEGAL_USE if this method, or setOutgoingNoChaining() method already invoked.
APDUException.IO_ERROR on I/O error.
public void setOutgoingLength(short len)
throws javacard.framework.APDUException
0 is specified, no data will be output.
Note:
APDU object to
STATE_OUTGOING_LENGTH_KNOWN.
len - the length of response datajavacard.framework.APDUException - 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.
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 on I/O error.
getOutBlockSize()public short receiveBytes(short bOff)
throws javacard.framework.APDUException
javacard.framework.APDUExceptionpublic short setIncomingAndReceive()
throws javacard.framework.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.
javacard.framework.APDUException - with the following reason codes:
APDUException.ILLEGAL_USE if setIncomingAndReceive() already invoked or
if setOutgoing() or setOutgoingNoChaining() previously invoked.
APDUException.IO_ERROR on I/O error.
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.
public void sendBytes(short bOff,
short len)
throws javacard.framework.APDUException
javacard.framework.APDUExceptionpublic void sendBytesLong(byte[] outData,
short bOff,
short len)
throws javacard.framework.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 block chaining must not be used.
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 sendjavacard.framework.APDUException - 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 on I/O error.
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.
SecurityException - if the outData array is not accessible in the caller's contextsetOutgoing(),
setOutgoingNoChaining()public void setOutgoingAndSend(short bOff,
short len)
throws javacard.framework.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 sendjavacard.framework.APDUException - ith the following reason codes:
APDUException.ILLEGAL_USE if setOutgoing()
or setOutgoingAndSend() previously invoked
or response byte count exceeded.
APDUException.IO_ERROR on I/O error.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.APDU.STATE_INITIALpublic static javacard.framework.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 object.
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.
See Runtime
Specification for the Java Card Platform, section
4.3 for encoding details.public static void waitExtension()
throws javacard.framework.APDUException
Notes:
javacard.framework.APDUException - with the following reason codes:
APDUException.ILLEGAL_USE if setOutgoingNoChaining() previously invoked.
APDUException.IO_ERROR on I/O error.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.
See Runtime Environment Specification for the Java Card Platform, 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.
See Runtime Environment Specification for the Java Card Platform, 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:2005 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 interindustry command, false otherwise.public short getIncomingLength()
javacard.framework.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)javacard.framework.APDUException - with the following reason codes:APDUException.ILLEGAL_USE if setIncomingAndReceive() not called
or if setOutgoing() or setOutgoingNoChaining() previously invoked.
getIncomingLength()