Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Chaining in T=1 protocol in javacard for data_size>256

966575Oct 22 2013 — edited Oct 24 2013

Dear Friends

I have a problem that confused me a couple of days. I want to send out data which has size bigger than 256. I found some sample codes in web. these codes like this:

private void sendData(APDU apdu) {

        // work out how many bytes to send this time and how many will be left

        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;

       

        // Get ready to send

        apdu.setOutgoing();

        apdu.setOutgoingLength((short)sendLen);

        apdu.sendBytesLong(data, BUF_IN_OFFSET[0], sendLen);

       

         // Check to see if there are more APDU's to send

        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 netbeans simulator it works currectly and response 61xx status word. but when i execute on real card (smartcafe 3.2 expert) it response 9000 and doesn't return remained data length. My card support both T=0/1 protocol and and i guess the used protocol related to this problem, or it may have another problem.

does this code executed for T=1 protocol correctly?

anyone can help me?

Thanks in advance.

Mohsen Mgh

This post has been answered by PraveenPT on Oct 24 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 21 2013
Added on Oct 22 2013
11 comments
5,282 views