Hi,
I just wonder what your opinion is about Java smart card io which is a
part of JDK 1.6 and forward.

I did a minute test and it wasn't overly convincing :-(

OTOH, as we all know that smart card middle ware is "hell on earth" I
may simple haven't given it enough time.

import javax.smartcardio.*;
import java.util.List;

public class smart
{
  public static void main (String[] args)
    {
      try
        {
          // show the list of available terminals
          TerminalFactory factory = TerminalFactory.getDefault();
          List<CardTerminal> terminals = factory.terminals().list();

          // get the first terminal
          if (terminals.isEmpty ())
            {
              System.out.println ("No terminals found!");
            }
          else
            {
              System.out.println("Terminals: " + terminals);
              CardTerminal terminal = terminals.get(0);
              // establish a connection with the card
              Card card = terminal.connect("T=0");
              System.out.println("card: " + card);
              CardChannel channel = card.getBasicChannel();
              // disconnect
              card.disconnect(false);
            }
        }
      catch (Exception e)
        {
           e.printStackTrace ();
        }
    }
}

On windows you get an exception if there is no reader connected!
On Ubuntu I always get No terminals found!

On both machines I have other smart card apps working including pcscd on Ubuntu
that in debug mode shows that the card is connected etc.

javax.smartcardio.* = Total crap IMNSHO.

Anders

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to