This content has been marked as final. Show 16 replies
933351 wrote:The select failed. The SW is 6999 (selection failed). If it worked you would expect a 9000 status word.
Received ATR = 0x3b 0xf0 0x11 0x00 0xff 0x00
CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 07, 1b, 85, 45, 1e, eb, c9, fb, Le: 00, SW1: 69, SW2: 99
Invalid Token after "0x7F", was expecting: <INTEGER_LITERAL>
Seems like the select has succeeded, but the command/data string was incorrect.
How do I select it correctly? I have this in my manifest.mf and applet.xml files
Manifest-Version: 1.0 Runtime-Descriptor-Version: 3.0 Application-Type: classic-applet Classic-Package-AID: //aid/1B85451EEB/3CB7
Thanks in advance
<?xml version="1.0" encoding="UTF-8"?> <applet-app xmlns="http://java.sun.com/xml/ns/javacard" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javacard http://java.sun.com/xml/ns/javacard/applet-app_3_0.xsd" version="3.0"> <applet> <!-- The applet application deployment descriptor conveys APDU-based application model elements and configuration information of an application between application developers, application assemblers, and deployers. --> <display-name>Time Attend Applet</display-name> <applet-class>com.walker.TimeAttendApplet</applet-class> <applet-AID>//aid/1B85451EEB/C9FB</applet-AID> </applet> </applet-app>
When I added these 2 statements to my program, I got these errors which I believed they were still some selection errors.
However, I've changed the adpu script from 0x80 0x00 0x7F to 0x80 0x00, if that makes a difference.
Edited by: 933351 on 2013/4/3 下午 8:16
Opening connection to localhost on port 9025. Connected. Received ATR = 0x3b 0xf0 0x11 0x00 0xff 0x00 CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 07, 1b, 85, 45, 1e, eb, c9, be, Le: 00, SW1: 90, SW2: 00 Invalid Token after "0x00", was expecting: <INTEGER_LITERAL>
933351 wrote:Just Selecting the applet will not return Get Hello message. To get this you need to send another APDU which will instruct the applet to return you byte array of Hello World string.
But it seems like it doesn't return the "12345" string from the method "getHello".
How do I get "12345" out of the console?
Now I've got one adpu file, which consists those command strings.
Do I separate out the 0x80 0x00 0x7F into other files?
How do I invoke them? One after one? and Shouldn't I poweroff the simulator after the selection? That means to comment out
that "poweroff" line. That will go?
Edited by: 933351 on 2013/4/5 上午 2:12
To get the hello world from your applet you need to perform following steps in sequence:
1. Select the reader
2. Connect to the card which is inside the reader you selected
3. Select the applet by sending SELECT Applet APDU
4. Upon 0x9000, Send get hello world APDU.
Now for the step-4, you need to prepare an APDU which will instruct your applet to return a byte array of hello world characters.
Suppose you are sending:
from the host application and in the applet, in process(), you should do something like:
80 00 00 00 00
And please note, i have not mentioned any power-off or reset.
case HW_INS: getHello(apdu); break;
Let me try to figure out, tell you back later.
I created a secondary apdu, and debug the applet (select it), when it returns okay.
I sent another adpu to the applet, I haven't powered down the java card.
But I still get
Invalid Token after "0x00", was expecting: <INTEGER_LITERAL>
//powerup; // Select the applet // 0x00 0xA4 0x04 0x00 <length> <aid bytes> 0x7F; // Send command APDUs here // 0x80 0xCA 0x00 0x00 <length> <data> 0x7F; 0x80 0x00; powerdown;
Edited by: 933351 on 2013/4/12 上午 12:59
Edited by: 933351 on 2013/4/12 上午 1:01
Edited by: 933351 on 2013/4/12 上午 1:02