javacard - How to send the APDU command to get a success response? -
i have method in javacard applet:
public void process(apdu apdu) { byte[] buf = apdu.getbuffer() ; switch(buf[iso7816.offset_ins]) { case 0x40: util.arraycopy(hello,(byte)0,buf,iso7816.offset_cdata,(byte)5); apdu.setoutgoingandsend(iso7816.offset_cdata,(byte)5); break; default: isoexception.throwit(iso7816.sw_wrong_ins) ; } }
here hello :
private final static byte[] hello = {0x48, 0x65, 0x6c, 0x6c, 0x6f };
and sending command in script follows:
powerup; // select installer applet 0x00 0xa4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7f; // create testapplet applet 0x80 0xb8 0x00 0x00 0xd 0xb 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00 0x00 0x00 0x7f; //show hello message 0x40 0x00 0x00 0x00; //this command mentioned in tutorial gave error powerdown;
the first 2 commands succeeded, last 1 gets error command not in correct format .
i tried command:
0x00 0x40 0x00 0x00 0x00 0x7f;
but gave me response 6d00
means ins
vlaue not supported.
here actual response:
cla: 80, ins:40, p1:00,p2:00,lc:00,le:00,sw1:6d,sw2:00
the expected response hello value along success reponse 9000
i following tutorial
what proper way give apdu command ?
as mentioned in answer @bzh, command 0x40 0x00 0x00 0x00
not correct.
the correct command
0x80 0x40 0x00 0x00 0x00
.
there 1 more problem: status word 6d00
not sent applet, sent card manager applet with
aid = a00000006203010801
you have selected after powerup
. card manager applet not know ins = 0x40
instruction, therefore status code. have select applet before sending commands:
00 a4 04 00 [lc] [... aid of applet instance...] 80 40 00 00 00
Comments
Post a Comment