krishnenc / seek-for-android

Automatically exported from code.google.com/p/seek-for-android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No SW2 filtering at protocolTransmit mehtod which is in Terminal.java

GoogleCodeExporter opened this issue · comments

What's the problem?
at protocolTransmit method which is in Terminal.java, there is no filtering 
options on sw2

according to "ETSI_TS_102_221v070200p_Smart cards_UICC Terminal 
Interface_Physical and logical characteristics" and
"info_isoiec7816-4{ed2.0}en" documentation, SW2 is distinctly decleared as below

SW1  SW2       Description
'63' 'F1' - More data expected
'63' 'F2' - More data expected and proactive command pending
'63' '00' - No information given
'63' '81' - File filled up by the last write
'63' 'CX' - Counter from 0 to 15 encoded by 'X' (exact meaning depending on the 
command)

when rsp is 63XX, it always retransmitting for getResponse. even if SW2 is not 
in above table
when SW1 == 63 && SW2(not in above table), I think it must be send rsp to 
application directly 

What is the expected output? What do you see instead?
Code likely to be fixed.
====================================
protected synchronized byte[] protocolTransmit(byte[] cmd) throws CardException 
{
...
    int sw1 = rsp[rsp.length - 2] & 0xFF;
+    int sw2 = rsp[rsp.length - 1] & 0xFF;
...
-    } else if (rsp.length == 2 && sw1 == 0x63) {
+    } else if (rsp.length == 2 && sw1 == 0x63 && (sw2 == 0xF1 || sw2 == 0xF2 
|| sw2 == 0x00 || sw2 == 0x81 || sw2 == 0xCX)) {
...
}

Original issue reported on code.google.com by dreamy...@gmail.com on 5 Feb 2013 at 6:28

updated in SCAPI-3.0.0

ETSI spec would not apply on eSE or MSC as they are not SIM cards. GetResponse 
is now only performed after a 63 10 response code: GP 2.x - more data

Original comment by Daniel.A...@gi-de.com on 15 Apr 2013 at 3:33

  • Changed state: Done