How to send more than 255 bytes in response APDU

Hi, I am developing an applet which may require to send more than 255 bytes in response apdu. How to do that?
[123 byte] By [mirala] at [2007-10-3 1:03:51]
# 1
If your card does not support the extended APDU (a very rare feature) you have to split it up into two or more APDUs. That means in your case that you have to implement a function that returns the remaining bytes which did not fit into the fits APDU.
JPJavaa at 2007-7-14 18:00:08 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 2

Can I have sort of example?

I think I have to indicate that in APDU that more bytes coming, but how will be next apdu will processed? I mean for that I have to create new buffer to store data and than when I will get next apdu with more bytes I have to append data into that buffer.

It seems me overhead or is it only way to send long response?

mirala at 2007-7-14 18:00:08 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 3

> I mean for that I have to create new buffer to store data and than

> when I will get next apdu with more bytes I have to append data into that buffer.

> It seems me overhead or is it only way to send long response?

Nobody said that programming a JavaCard is easy.

Jan

JPJavaa at 2007-7-14 18:00:08 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 4

You can try the following sequence:

apdu.setOugoing();

apdu.setOutgoingLength(Len);

apdu.sendBytesLong(var1,(short)0,(short)var1.lenth);

apdu.sendBytesLong(var2,(short)0,(short)var2.lenth);

apdu.sendBytesLong(var3,(short)0,(short)var3.lenth);

etcccc....

return;

hope it helps

razzaja at 2007-7-14 18:00:08 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 5

Hi razzaz...

I'm newbie on javacard and i want to send more than 255 bytes in response apdu.

I've tried to using the sample code u gave, but now i'm confused to receive multiple response apdu in my host aplication. It always gives me 6180 exception. Here the code i 'm using on card ...

apdu.setOutgoing();

apdu.setOutgoingLength(result);

apdu.sendBytesLong(cmd_apdu, (short)0, (short)64);

apdu.sendBytesLong(cmd_apdu, (short)64, (short)64);

var result will gave (short) 128 that is 256 bytes. Am i right?

Is it my code right? if does, how to receive the response apdu at my host app? If doesn't, what's the right code?

Thanks in advance...

DeeYaha at 2007-7-14 18:00:08 > top of Java-index,Java Mobility Forums,Consumer and Commerce...
# 6

By sending the status code 6180 the card tells the off-card entity that it can fetch 0x80 (= 128) bytes from the card.

Normally this is done by sending an ISO "GET RESPONSE" command, e.g. "00 C0 00 00 80".

After sending the GET RESPONSE command the off-card entity will receive the data and a new status code.

If this is something like 61XY then more data (0xXY) can be fetched. If the status code is 9000 then all data is received.

Also see http://www.cardwerk.com/smartcards/smartcard_standard_ISO7816-4_7_transmission_interindustry_commands.aspx#chap7_1

for more information on GET RESPONSE.

Have fun.

lionkinga at 2007-7-14 18:00:08 > top of Java-index,Java Mobility Forums,Consumer and Commerce...