JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

the client application with a JCOP card

JavaCard Applet Development Related Questions and Answers.
Aesir
Posts: 12
Joined: Tue Jun 14, 2016 2:22 am
Points :156
Contact:

the client application with a JCOP card

Post by Aesir » Tue Jun 14, 2016 11:51 pm

I have finished an application which have to compute some data and exchange information with a JCOP card.
But when I launch the card with the simulator generic JCOPv2.2.1 and my client application.
The card is connected but the app is blocked on the powerUp() instruction.Could anyone point me if it is the correct way to connect and to create a session between the application and the simulator?

Code: Select all

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.net.Socket;

import utils.Constants;

import com.sun.javacard.apduio.Apdu;
import com.sun.javacard.apduio.CadT1Client;

public class Reader {
     
     public static void main(String[] args) throws Exception {
          /* Connection to the Javacard */
          CadT1Client cad;
          Socket sckCarte;
         
          try {
               sckCarte = new Socket("localhost", 8050);
               sckCarte.setTcpNoDelay(true);
               BufferedInputStream input = new BufferedInputStream(
                         sckCarte.getInputStream());
               BufferedOutputStream output = new BufferedOutputStream(
                         sckCarte.getOutputStream());
               cad = new CadT1Client(input, output);
          } catch (Exception e) {
               System.out.println("Error : impossible  to connect to the Javacard");
               return;
          }

          System.out.println("Card Connected");
         
          /* Power up the card */
          try {
               cad.powerUp();
          } catch (Exception e) {
               System.out.println("Error powerup to Javacard");
               return;
          }
         
          System.out.println("Card power up!");
        }
}

Eaonm
Posts: 3
Joined: Sat Dec 05, 2015 3:08 am
Points :8
Contact:

Re: the client application with a JCOP card

Post by Eaonm » Wed Jun 15, 2016 5:27 am

You may not need to use the power up command to communicate with the simulator. You could look at the OpenCard Framework library for a way to communicate with the JCOP simulator.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 33 guests

JavaCard OS : Disclaimer