Java and security bits

Sunday Nov 13, 2005

JSR 268 Integrated into Mustang

I wanted to let everyone know that JSR 268 code is now available as part of the Mustang snapshot builds (actually, it has been there for a while). You can download binaries and the source from mustang.dev.java.net.

What does that mean for you? If you do not care about Smart Cards or don't speak ISO 7816, not much.

However, for those of you that do care, it means that you can now write code like the following:

    // show the list of available terminals
    TerminalFactory factory = TerminalFactory.getDefault();
    List<CardTerminal> terminals = factory.terminals();
    System.out.println("Terminals: " + terminals);
    // get the first terminal
    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();
    ResponseAPDU r = channel.transmit(new CommandAPDU(c1));
    System.out.println("response: " + toString(r.getBytes()));
    // disconnect
    card.disconnect(false);

And it will work on Solaris, Linux, and Windows. That is, assuming you have a Smart Card reader, a Smart Card, and they are available via PC/SC on your OS. If you are into this kind of thing, you probably know what that means. But specifically, libpcsclite.so needs to be present in either /usr/lib or /usr/local/lib on Solaris and Linux. (On Solaris 10, it is there by default).

As for documentation, that is rather sparse at the moment. You can download the JavaDocs from the JCP web site. I am working on getting that and more added to the Mustang documentation. Note that the Smart Card I/O JavaDocs are not and will not be part of the Mustang JavaDocs because JSR 268 is not part of the Java SE 6 specification. It is part of the Sun implementation of course, so for many of you this will not matter much.

That's all for now. If you have any comments, please email them to jsr-268-comments@jcp.org. BTW, I'll try to blog more frequently in the future. Actually, I already have something planned regarding a change we made to another Java SE component. Stay tuned.

Comments:

Post a Comment:
Comments are closed for this entry.

Calendar

Feeds

Links

Recent Posts

Referers