Skip to Main Content

Java Card

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java 6: javax.smartcardio - can't get CPLC

843851Mar 25 2009 — edited Apr 15 2009
Hello! I have a problem - can't get CPLC with classes from javax.smartcardio (get SW=6a88), but I easily get it with com.sun.javacard.apduio classes from Java Card Kit 2.2.2.

Here the test code for javax.smartcardio :
import java.util.List;
import javax.smartcardio.*;

public class TestSmartCardJSE60
{
 public static void main(String[] args)
 {
  try
  {
   TerminalFactory tf = TerminalFactory.getInstance("PC/SC", null);
   CardTerminals cts = tf.terminals();
   List<CardTerminal> avaiableTerminals = cts.list();
   CardTerminal ct = avaiableTerminals.get(0);
   Card card = ct.connect("*");
   try
   {
    CardChannel channel = card.getBasicChannel();

    CommandAPDU capdu = new CommandAPDU(0x80, 0xCA, 0x9F, 0x7F);
    ResponseAPDU res = channel.transmit(capdu);
    System.out.printf("%s%n", res);
   }
   finally
   {
    card.disconnect(true);
   }
  }
  catch(Exception e)
  {
   e.printStackTrace();
  }
 }
}
And here the same for com.sun.javacard.apduio
import com.sun.javacard.apduio.*;

public class TestSmartCardJCK222
{
 public static void main(String[] args)
 {
  try
  {
   CadClientInterface cad = CadDevice.getPCSCClientInstance(0);
   cad.powerUp();
   try
   {
    Apdu capdu = new Apdu();
    capdu.command[Apdu.CLA] = (byte) 0x80;
    capdu.command[Apdu.INS] = (byte) 0xCA;
    capdu.command[Apdu.P1] = (byte) 0x9F;
    capdu.command[Apdu.P2] = 0x7F;
    
    cad.exchangeApdu(capdu);
    System.out.printf("%s%n", capdu);
    
    capdu.setLe(0x2D);
    cad.exchangeApdu(capdu);
    System.out.printf("%s%n", capdu);
   }
   finally
   {
    cad.powerDown(true);
   }
  }
  catch(Exception e)
  {
   e.printStackTrace();
  }
 }
}
I run both tests under WindowsXP SP3 with ORGA ECO5000 Usb and JCOP21 smart card.

What is my problem? Actualy I want to use javax.smartcardio for my application, because classes from that package more useful than com.sun.javacard.apduio;

Any ideas?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2009
Added on Mar 25 2009
1 comment
269 views