This discussion is archived
0 Replies Latest reply: Jan 31, 2013 6:52 AM by 959791 RSS

External Access to the NetBeans JC 3.0 connected emuator

959791 Newbie
Currently Being Moderated
Hey everyone,

[SOLVED]

I am currently trying to turn the NetBeans JC emulator into something, which I can feed with APDUs from external sources. I know, that NetBeans just uses the apdutool, the reference implementation and a couple of other programs from the JCC sdk, but it seems to build a very special environment for their execution and it was not possible to address the reference implementation from an own program on the local port it is running on. Has anyone here ever tried to do something similar and can provide useful hints? Would be very grateful, since it is a real pain. My current approach is to make an external call to the apdutool and modify the script passed to it. The problem, which I am facing, is that the call fails and says it cannot find the Main class of the apdutool. It is in the tools.jar file (JCC_LOC/lib/tools.jar), but adding that jar to the classpath did not help for whatever reason. I assume, that I will have to set an other environment variable or something like that.

What I am trying at the moment:

I created a modified version of the apdutool.bat, which directly passes the location of the JCC in the JC_CONNECTED_HOME variable, so that should not be the problem (regular uses %~dp0):
#set home
set JC_CONNECTED_HOME="C:\Programs\NetBeans_7.3_Beta\javacard\JCDK3.0.2_ConnectedEdition\"
....
#add tools to classpath
set JC_CLASSPATH=%JC_CONNECTED_HOME%\lib\tools.jar;%JC_CLASSPATH%
....
#call:
"%JAVA_HOME%\bin\java" -Djc.home=%JC_CONNECTED_HOME% -classpath %JC_CLASSPATH% com.sun.javacard.apdutool.Main %*

I verified, that tools.jar contains the necessary class:
com.sun.javacard.apdutool.Main

but the call fails saying, that "com.sun.javacard.apdutool.Main" cannot be found.

Any ideas?
[SOLUTION]

Problem was a whitespace.

External access to the card is possible via the apdutool. You can call it from any other program or script, if you specify the correct command line. In Windows that means you will probably have to do a "cmx.exe -c " and pass the !!!full command!!! e.g. "apdutool -p 9026 apdu.scr" to cmd as string. It is important, that you pass the full command, because cmd.exe -c takes only one argument, which is a String. Based on that you can write a proxy.

Edited by: mdorner on 31.01.2013 06:48

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points