MegadLu / seek-for-android

Automatically exported from code.google.com/p/seek-for-android
0 stars 0 forks source link

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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