TalkNFC - NFC Technology Forum
Near Field Communications Discussion Forum
Talking about NFC technology services everywhere, at any time, using any device!
March 10, 2010, 06:44:37 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] |   Go Down
  Print  
Author Topic: NFC applet: communicatie with usb reader?  (Read 4421 times)
marcvandam2
TalkNFC New Consumer
*
Offline

Posts: 2

I'm New Here So Be Gentle


View Profile
« on: December 03, 2006, 06:19:53 PM »

Hello,

I have a problem working with "HelloApplet" from Nokia NFC/RFID SDK.

I installed the HelloApplet (on the javacard of the shell),
and the HelloMidlet (on the Nokia 3220)..

When I open HelloMidlet and enter the name "Marc",
the HelloApplet correctly answers "Hello Marc"...

When I try to send APDU using a usb reader, I always get
the error "6985" (Conditions of use not satisfied)

[COLOR="Red"]Is it possible connect to applets (installed on
Nokia 3220 NFC shell) using a USB reader?

Anyone has any tips on how to do this?
[/COLOR]



--------------------------------------------------------------------------

I use an OMNIKEY CardMan 5121. (works great for uploading Applet)

I made a Java application to transmit APDU to the Nokia 3220 NFC shell. 

I send the following APDU to the GSM:
80 01 00 00 04 4A 61 6E 65      (as written in Nokia SC Programmers manual)

Explained:
(80 01 00 00 == for HelloApplet to get triggered)
(04 == 4 bytes coming)
(4A 61 6E 65 == Jane)

I also tryed to switch Nokia 3220 shell SCCmode (SC-on,SC-only,SC-off)
no effect with that either...

CMD output: (from Java source)
Code:
Open terminal ...
--Waiting for card...
ATR=3B 88 80 01 00 73 C8 40 00 00 90 00 62             ;....s.@....b
 => 80 01 00 00 04 4A 61 6E 65                         .....Jane
 (8571 usec)
 <= 69 85                                              i.
Status: Conditions of use not satisfied

   Java source: (for sending APDU)
Code:
import java.io.*;
import com.ibm.jc.*;
import com.ibm.jc.terminal.*;

public class test_apdu
{
public static void main(String[] args)
{
System.out.println("Open terminal ...");
JCTerminal term = JCTerminal.getInstance
("pcsc:4", "OMNIKEY CardMan 5x21-CL 0");

term.open();
TraceJCTerminal _term = new TraceJCTerminal();
_term.setLog(new PrintWriter(System.out));
_term.init(term);
term = _term;

JCard card = new JCard(term, null, 10000);

byte[] send_final = {
(byte)0x80,(byte)0x01,(byte)0x00,
(byte)0x00,(byte)0x04,(byte)0x4A,
(byte)0x61,(byte)0x6E,(byte)0x65};

System.out.println("SEND...");
byte ontvangen[]= term.send(0,send_final,0,send_final.length);
term.close();
}

}
Logged
nitegate
TalkNFC New Consumer
*
Offline

Posts: 6


I'm New Here So Be Gentle


View Profile
« Reply #1 on: December 05, 2006, 08:45:15 AM »

Hi marcvandam2,

may I ask where did you get the nokia nfc sdk? i'm looking for this kit myself.

thx,
nitegate.
Logged
really_boring
TalkNFC New Consumer
*
Offline

Posts: 4

I'm New Here So Be Gentle


View Profile
« Reply #2 on: December 05, 2006, 09:34:56 PM »

Hello nitegate,

When you want communicate to Applet,  first you have to select your Applet before sending any command.
From your screen capture,  I do not see any select command.

HTH.

-really_boring
Logged
marcvandam2
TalkNFC New Consumer
*
Offline

Posts: 2

I'm New Here So Be Gentle


View Profile
« Reply #3 on: December 18, 2006, 05:00:32 AM »

Hello really_boring,

Thanks for your reply.

Indeed it was the "select" statement that was missing.

Working code for the 'Helloapplet' looks like this:

Code:

import java.io.*;
import com.ibm.jc.*;
import com.ibm.jc.terminal.*;

public class test_apdu
{

            public static void main(String[] args)

            {

 

                        System.out.println("Open terminal ...");

 

                        JCTerminal term = JCTerminal.getInstance("pcsc:4", "OMNIKEY CardMan 5x21-CL 0");

 

                        term.open();

 

                        term.waitForCard(10000);

 

                        TraceJCTerminal _term = new TraceJCTerminal();

 

                        _term.setLog(new PrintWriter(System.out));

 

                        _term.init(term);

 

                        term = _term;

 

                        JCard card = new JCard(term, null, 10000);

 

                        // selecteer applicatie in

 

                        System.out.println("\nSEND1... (SELECT JAVACARD APPS..)\n");

 

                        byte[] send_final = {(byte)0x00,(byte)0xA4,(byte)0x04,(byte)0x00,(byte)0x0E,

 

                        (byte)0x48,(byte)0x65,(byte)0x6C,(byte)0x6C,(byte)0x6F,

 

                        (byte)0x41,(byte)0x70,(byte)0x70,(byte)0x6C,(byte)0x65,

 

                        (byte)0x74,(byte)0x2E,(byte)0x61,(byte)0x70,(byte)0x70};

 

                        byte ontvangen[]= term.send(0,send_final,0,send_final.length);

 

                        System.out.println("\nSEND2... (STUURT NAAM..)\n");

 

                        String naam = "Marc";

 

                        byte[] byte_naam = naam.getBytes();

 

                        int CLA = (byte)0x80;

 

                        int INS = (byte)0x01;

 

                        int P1 =  (byte)0x00;

 

                        int P2 =  (byte)0x00;

 

                        byte ontvangen2[]= card.send(0,CLA,INS,P1,P2,byte_naam.length,byte_naam,0,0);

 

                        //send(int nad, int cla, int ins, int p1, int p2, int p3, byte[] toSend, int offset, int le)

 

                        term.close();

 

            }

 

}


 
Logged
Pages: [1] |   Go Up
  Print  
 
Jump to:  


Looking For
NFC Football?
Click Here

International Sports Forum  For Fans!




NFC-Forum.org
NFC Forum Organization | Mobile Payment Forum | 1001 Guides |
TalkNFC.com NFC Technology Forum |
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!