JTmartins Active Member Licensed User Longtime User Oct 22, 2014 #1 I'm reading values from a smart card, using an external lib and JavaObject When I perform a Warm Reset I get an ATR string. The values I obtain in the array (defined as object or java object (tested both)) are as following : 3B 7D FFFFFF95 0 0 FFFFFF80 31 FFFFFF80 etc. The problem is that I know for a fact (documentation from card issuer) that the values should be 3B 7D 95 0 0 80 31 80 etc. By looking closely the values I'm getting extra " FFFFFF ", but not in all of them (in the picture all the values with this problem show as negative) If I try the test application from the smart card, the values apear as expected. Is it me doing something really stupid or is this a bugg ? Attachments values.jpg 56 KB · Views: 324 Last edited: Oct 22, 2014
I'm reading values from a smart card, using an external lib and JavaObject When I perform a Warm Reset I get an ATR string. The values I obtain in the array (defined as object or java object (tested both)) are as following : 3B 7D FFFFFF95 0 0 FFFFFF80 31 FFFFFF80 etc. The problem is that I know for a fact (documentation from card issuer) that the values should be 3B 7D 95 0 0 80 31 80 etc. By looking closely the values I'm getting extra " FFFFFF ", but not in all of them (in the picture all the values with this problem show as negative) If I try the test application from the smart card, the values apear as expected. Is it me doing something really stupid or is this a bugg ?
thedesolatesoul Expert Licensed User Longtime User Oct 22, 2014 #2 Its not a bug, its just sign extension. If the 8th bit is set, then you get a negative value i.e. FFFF all the way. Upvote 0
Its not a bug, its just sign extension. If the 8th bit is set, then you get a negative value i.e. FFFF all the way.
JTmartins Active Member Licensed User Longtime User Oct 22, 2014 #3 Many thanks Desolated. So I guess this wil do...I hope !!! Code: Copy For f=0 To bytarray.Length-1 Private c As int c=bytarray(f) If c<0 Then c=Bit.AND (c,255) End If Next Upvote 0
Many thanks Desolated. So I guess this wil do...I hope !!! Code: Copy For f=0 To bytarray.Length-1 Private c As int c=bytarray(f) If c<0 Then c=Bit.AND (c,255) End If Next
thedesolatesoul Expert Licensed User Longtime User Oct 22, 2014 #4 Yes, infact you do not need to check (if c<0) as the anding the +ve values will have no effect. Upvote 0