2011/11/23 Anders Rundgren <[email protected]>:
> Hi,
Hello,
> 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.
Do you know "PCSC sample in Java" [1]?
> 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!
I can't tell about Windows.
> On Ubuntu I always get No terminals found!
Ubuntu has a special configuration of pcsc-lite. Read "pcsc-lite
upgrade and Ubuntu special configuration" [2].
> 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.
You have not tried hard enough :-)
Bye,
[1] http://ludovicrousseau.blogspot.com/2010/06/pcsc-sample-in-java.html
[2]
http://ludovicrousseau.blogspot.com/2010/10/pcsc-lite-upgrade-and-ubuntu-special.html
--
Dr. Ludovic Rousseau
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel