lihq / seek-for-android

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

APDU Class 4 doesn't work on Samsung Galaxy S3 (GT-I9300) #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What's the problem?
APDU Class 4 doesn't work on Samsung Galaxy S3 (GT-I9300)

What steps will reproduce the problem?
1. Send any APDU class 4 command with non-empty command data (for example, 
Global Platform Initialize Update) using channel.transmit.

What is the expected output? What do you see instead?
Response Data is expected, but only SW 9000 is returned.

What version of the product are you using? On what operating system?
Smart Card API 2.3.2. Samsung GT-I9300. Android 4.0.4. OS Build: 
IMM76D.I9300XXALEF. Baseband: I9300XXLEF. All the same as in Device Support 
Wiki section.

Please provide any additional information below.
Response is returned fine in there is no command data. Tested with Card 
Manager, custom applets - same result everywhere.

Original issue reported on code.google.com by Gracioso...@gmail.com on 2 Oct 2012 at 2:29

GoogleCodeExporter commented 9 years ago
Could you provide some additional data: APDU which you are sending, snippet of 
code used for sending? 
Did you try to send the same APDU to SIM using external reader and GPShell tool?

Original comment by m.lipin...@samsung.com on 16 Oct 2012 at 10:18

GoogleCodeExporter commented 9 years ago
Standard global platform compatible Initialize Update command:
80500000080102030405060708
On Samsung SGS3 via Smartcard API it returns only 9000, without any data.
If sent via contactless interface everything is OK (response data is present). 
It works correctly when sent to card via contact reader (not from phone). 
Moreover the same card works perfectly on Sony Xperia S.

Sample code (works on Xperia S):
Reader[] readers = seService.getReaders();
Reader currentReader = readers[0];
Session session = currentReader.openSession();
Channel channel = session.openLogicalChannel(Hex.decode(appAid));
byte[] initUpdate = { (byte) 0x80, 0x50, 0x00, 0x00, 0x08, 0x01, 0x02, 0x03, 
0x04, 0x05, 0x06, 0x07, 0x08};
byte[] respApdu = channel.transmit(initUpdate);

P.S.: Tried sending via internal telephony API (ITelephony class) using method 
transmitIccLogicalChannel - result was the same - only SW1SW2 response.

Original comment by Gracioso...@gmail.com on 16 Oct 2012 at 12:03

GoogleCodeExporter commented 9 years ago
To conform to APDU case 4 format please add Le byte at the end of the command 
f.e. byte[] initUpdate = { (byte) 0x80, 0x50, 0x00, 0x00, 0x08, 0x01, 0x02, 
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00 }; to get the whole response.

Original comment by m.lipin...@samsung.com on 16 Oct 2012 at 12:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Thanks, adding Le byte to the end of the command really helped. Now everything 
is working as it should. And maybe you can help with one more question:
method channel.getSelectResponse() is always null.
I think these two are connected somehow. 

Original comment by Gracioso...@gmail.com on 16 Oct 2012 at 12:39

GoogleCodeExporter commented 9 years ago
channel.getSelectResponse() returns proper value only if your application try 
to open basic channel.
Galaxy S3, however, doesn't support using basic channel by now.
That means you get null as a result of calling channel.getSelectResponse().

Original comment by dh...@samsung.com on 17 Oct 2012 at 2:32

GoogleCodeExporter commented 9 years ago
Allright then. Thanks for help.

Please, mark this issue as resolved.

Original comment by Gracioso...@gmail.com on 17 Oct 2012 at 6:12

GoogleCodeExporter commented 9 years ago
hi i am using Smart Card API 2.3.2, Samsung GT-I9300, Android 4.0.4, Base band 
I9300DDLHI, Build Number IMM76D.I9300XXBLHI.
I want my application to select proprietary applet and send/receive APDU to it 
,on UIIC.    
What kind of SIM card i Should use ? Please HELP!!!

Original comment by innolab...@gmail.com on 6 Nov 2012 at 12:35

GoogleCodeExporter commented 9 years ago
Resolved according to comment #7 from GraciosoMierda

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