JCOP20 card too old and Samples for JCOP Offcard API (RMI)
Hi all!
I have two problems/questions in which you might be able to help me.
I plan to develop a Java Card application which uses the JC-RMI api and an according Offcard application which uses the JCOP Offcard RMI API.
I have Eclipse 3.1 and JCOP Tools 3.1 for that.
To try my setup, i decided to use a sample application. I took the Purse application from the java card dev kit 2.2.1, which uses RMI and OCF in the offcard app. I tried it out with the JC Simulator included in the JCOP tools - the upload of the applet worked. First problem - how can i test the offcard application (how to configure OCF to use the simulator on port 80xx something)?
Second (much worse) problem: For my project, i have java cards which i bought at this shop: http://www.cardomatic.de/start.htm?java_smart_cards.htm
I have the JCOP20 card. When trying to upload the applet to the card, i got this:
<= 6A 80 j.
Status: Wrong data
jcshell: Error code: 6a80 (Wrong data)
jcshell: Wrong response APDU: 6A80
Unexpected error; aborting execution
As setting for the card, i took "jcop engineering sample", because i didn't know what to do - can the problem rely on this step or is the card not capable of what I'm planning to do?
Another problem I have is that I cannot find any sample code for the JCOP offcard api, which means I really don't know how to start my offcard application. Can someone provide me with some examples? The best thing would be a sample application with the use of jcop offcard rmi api.
Thanks in advance for your replies! It's very much appreciated!
Matthias
[1665 byte] By [
bobdmba] at [2007-10-2 4:07:19]

> I have two problems/questions in which you might be
> able to help me.
> I plan to develop a Java Card application which uses
> the JC-RMI api and an according Offcard application
> which uses the JCOP Offcard RMI API.
> I have Eclipse 3.1 and JCOP Tools 3.1 for that.
>
> To try my setup, i decided to use a sample
> application. I took the Purse application from the
> java card dev kit 2.2.1, which uses RMI and OCF in
> the offcard app. I tried it out with the JC Simulator
> included in the JCOP tools - the upload of the applet
> worked. First problem - how can i test the offcard
> application (how to configure OCF to use the
> simulator on port 80xx something)?
You can use the "WrapperFactory" posted in the thread "OCF and Java Card Applet":
http://forum.java.sun.com/thread.jspa?forumID=23&threadID=570553
> Second (much worse) problem: For my project, i have
> java cards which i bought at this shop:
> http://www.cardomatic.de/start.htm?java_smart_cards.ht
> m
> I have the JCOP20 card.
That is a JavaCard 2.1.2 card. You won't succeed in using it with JC-RMI. You need a JavaCard 2.2.1 card like the new JCOP41v2.2 card if you want to use JC-RMI.
> Another problem I have is that I cannot find any
> sample code for the JCOP offcard api, which means I
> really don't know how to start my offcard
> application. Can someone provide me with some
> examples? The best thing would be a sample
> application with the use of jcop offcard rmi api.
My be this sample code helps you:
import com.ibm.jc.JCApplet;
import com.ibm.jc.JCTerminal;
import com.ibm.jc.JCard;
import com.ibm.jc.rmi.RMIObjectFactory;
public class JcopTest {
public static void main(String[] args) {
try {
//connect to the JCOP emulator on port 8050
JCTerminal terminal = JCTerminal.getInstance("remote",null);
terminal.open();
JCard card = new JCard(terminal,null,0);
JCApplet applet = new JCApplet(card,"myaid".getBytes());
applet.select();
// get the first CardRemoteObject from the card
Object o = RMIObjectFactory.getInitialReference(applet);
MyInterface i = (MyInterface) o;
//i.callMethodeViaRMI(..)
} catch (Exception e) {
e.printStackTrace();
}
}
}
Jan