bladox.com Forum Index bladox.com
Turbo SIM Toolkit Adapter Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get SW1 and SW2

 
Post new topic   Reply to topic    bladox.com Forum Index -> Development
View previous topic :: View next topic  
Author Message
godwinamila



Joined: 03 Aug 2010
Posts: 9

PostPosted: Wed Jan 26, 2011 7:52 pm    Post subject: Get SW1 and SW2 Reply with quote

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
View user's profile Send private message
pz



Joined: 12 Mar 2004
Posts: 1161

PostPosted: Tue Feb 08, 2011 9:50 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    bladox.com Forum Index -> Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group