Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

Problem in sending extended APDU

JavaCard Applet Development Related Questions and Answers.
hosseinpro
Posts: 13
Joined: Wed Jun 28, 2017 6:35 pm
Points :190
Contact:

Problem in sending extended APDU

Post by hosseinpro » Wed Jul 12, 2017 4:38 pm

Hi
I have a problem in receiving extended length APDU.
I send an APDU with about 700 bytes but in my applet that I run in virtual reader, I receive only 243 bytes.
The buffer length is always 261, and with T0 inBufferLength is 243 and with T1 inBufferLength is 153.

Can I use extended length in JCIDE?

this is my applet code:

Code: Select all

package myApplet;

import javacard.framework.*;
import javacard.security.*;
import javacardx.crypto.Cipher;
import javacardx.apdu.ExtendedLength;

public class myApplet extends Applet implements ISO7816, ExtendedLength
{
...
   public void process(APDU apdu)
   {
      if(selectingApplet()){
         return;
      }
      
      byte[] buf = apdu.getBuffer();
           short inBufferLength = apdu.setIncomingAndReceive();
           byte p1 = inBuffer[ISO7816.OFFSET_P1];
           byte p2 = inBuffer[ISO7816.OFFSET_P2];
}

User avatar
mabel
Posts: 237
Joined: Mon May 18, 2015 3:09 am
Points :1705
Contact:

Re: Problem in sending extended APDU

Post by mabel » Thu Jul 13, 2017 12:05 am

Refer to this code section:

Code: Select all

short readCount = apdu.setIncomingAndReceive();

while ( bytesLeft  >  0){
     // process bytes in buffer[5] to buffer[readCount+4];
     bytesLeft -= readCount;
     readCount = apdu.receiveBytes ( ISO7816.OFFSET_CDATA );
}


You need to call receiveBytes to receive the left bytes.

hosseinpro
Posts: 13
Joined: Wed Jun 28, 2017 6:35 pm
Points :190
Contact:

Re: Problem in sending extended APDU

Post by hosseinpro » Thu Jul 13, 2017 11:46 am

Yes, it works.
thank you for quick response!

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 61 guests

JavaCard OS : Disclaimer