A problem in java card for data size bigger than 256
Posted: Thu Jan 14, 2016 1:17 am
I have run into a problem for some days. I want to send out data which has the size bigger than 256.
And I use the code:
When I execute this code on my real card(support T1/T0), I got "0x90 0x00",which "0x61 0xXX is expected(XX is the remained data length). I guess the used protocol related to this problem. I m not sure!
Can anyone help me? Thanx for any help!
And I use the code:
Code: Select all
private void sendData(APDU apdu) {
BUF_IN_OFFSET[0] = 0;
short remain = (short) ((short)372 - BUF_IN_OFFSET[0]);
boolean chain = remain > MAX_APDU;
short sendLen = chain ? MAX_APDU : remain;
apdu.setOutgoing();
apdu.setOutgoingLength((short)sendLen);
apdu.sendBytesLong(data, BUF_IN_OFFSET[0], sendLen);
if (chain) {
BUF_IN_OFFSET[0] += sendLen; // count the bytes sent
remain -=sendLen;
ISOException.throwIt((short)(ISO7816.SW_BYTES_REMAINING_00 + remain));
} else {
BUF_IN_OFFSET[0] = 0; // no more bytes to send
}
}
When I execute this code on my real card(support T1/T0), I got "0x90 0x00",which "0x61 0xXX is expected(XX is the remained data length). I guess the used protocol related to this problem. I m not sure!
Can anyone help me? Thanx for any help!