View previous topic :: View next topic |
Author |
Message |
godwinamila
Joined: 03 Aug 2010 Posts: 9
|
Posted: Wed Jan 26, 2011 7:52 pm Post subject: Get SW1 and SW2 |
|
|
Hi
I have a waver application that communicate with java card. When I send a APDU to applet it gives a response. I am checking this response as follows
i = twin_t1_apdu(sizeof(t_authenticate), buf);
u16 ret;
ret = buf[i - 3];
ret <<= 8;
ret |= buf[i - 2];
if (ret == 0x9000){
ret_data[0] = 0x90;
ret_data[1] = 0x00;
}else{
ret_data[0] = 0x6e;
ret_data[1] = 0x04;
}
By using this I get 9000 when success the command and when fail it gives 6e04. I need to get the exact response that comes from applet. Here every time when getting a error it gives 6e04. How can unwrap this u16 ret and fill it into a buf_B and send it back.
If someone can give a idea to sort out this issue it'll be a great help to continue my work.
Regards
Amila |
|
Back to top |
|
|
pz
Joined: 12 Mar 2004 Posts: 1161
|
Posted: Tue Feb 08, 2011 9:50 am Post subject: |
|
|
You get T=1 packet, SW1/SW2 is at the end pos minus 1, see T=1 spec.
j = twin_t1_apdu (len, buf);
ret = buf[j - 3];
ret <<= 8;
ret |= buf[j - 2]; |
|
Back to top |
|
|
|