Page 1 of 1

Send data to java card through APDU

Posted: Sat Jan 23, 2016 5:46 am
by kineri
I want to create an applet which sends some data to a java card.

This is part of the code.

Code: Select all

apdu = new Apdu();
          apdu.command[Apdu.CLA] = TestComm.CLA_MYAPPLET;
          apdu.command[Apdu.P1] = 0x00;
          apdu.command[Apdu.P2] = 0x00;
          apdu.command[Apdu.INS] = TestComm.INS_GENERATE_SIGN;
          cad.exchangeApdu(apdu);
          if (apdu.getStatus() != 0x9000) {
               System.out.println("Errorr : status word different from 0x9000");
          } else {
               . . .


I thought that I could give data through P1, but it only accepts a single byte and I have to transmit an array of byte. I am confused. Does anyone give me a clear explanations?

Re: Send data to java card through APDU

Posted: Sat Jan 23, 2016 11:49 pm
by UNKNwYSHSA
The APDU data field is for your requirement.
The data field is start with the offset Apdu.DATA.