JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

Is it possible to return some data along with the status word 9000 on selecting an applet in javacard?

JavaCard Applet Development Related Questions and Answers.
Lehrling81
Posts: 10
Joined: Fri Nov 20, 2015 1:47 am
Points :41
Contact:

Is it possible to return some data along with the status word 9000 on selecting an applet in javacard?

Post by Lehrling81 » Thu Nov 26, 2015 5:37 am

I was wondering if i could send back some data from the java card applet when it is selected.

Since select() method returns a boolean value, I don't know how to return data bytes from it.

Can anyone help me with this? i want the applet to return a simple byte array along with the status word 9000 (which is default for success), when i send the select command to the card.

ie, when i send the following command

00 A4 04 00 06 01 02 03 04 05 06

i want a response like,

01 02 03 04 90 00

(first four bytes are the data returned from the applet)

Thanks in advance.

rena2019
Posts: 68
Joined: Thu Aug 20, 2015 4:16 pm
Points :1790
Contact:

Re: Is it possible to return some data along with the status word 9000 on selecting an applet in javacard?

Post by rena2019 » Thu Nov 26, 2015 7:34 am

Code: Select all

public void process(APDU apdu) {
      if (selectingApplet()) {
         apdu.getBuffer()[0] = 0x01;
         apdu.getBuffer()[1] = 0x02;
         apdu.getBuffer()[2] = 0x03;
         apdu.getBuffer()[3] = 0x04;
         apdu.setOutgoingAndSend((short)0, (short)4);
         return;
      }
       ...


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

Re: Is it possible to return some data along with the status word 9000 on selecting an applet in javacard?

Post by mabel » Fri Nov 27, 2015 6:01 am

Code: Select all

public void process(APDU apdu) 
{
  byte[] buf = apdu.getBuffer();
  if (selectingApplet())
       {
          //send  data in the buffer
          return;
       }
}

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 23 guests

JavaCard OS : Disclaimer