Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Ring fever: A first-hand look at Java-powered jewelry

<em>JavaWorld</em> columnist and former JavaSoft engineer Chuck McManis gets a serious case of technology fever

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

Page 3 of 4

Day 3: He went thatta way!

Day three started a bit slowly. I actually woke up at 6:00 a.m., turned off my alarm and then got out of bed around 9:00 a.m. So much for the panel of experts on the future of Java. That was OK; I arrived in time to attend JavaWorld columnist and Sun engineer Rinaldo Di Giorgio's talk on smart cards. That was helpful and explained what some of the terms -- such as APDU -- I'd been reading about in the ring docs meant. Armed with new knowledge, I went hunting for a Dallas Semiconductor application engineer.

These guys turned out to be harder to find than I would have expected. I finally tracked one down in the Hackers' Lab and talked to him about my lack of success so far. Once we got down to specifics, we discovered I had hooked my ring to COM3, but the library only knows about COM1 and COM2. For those of you who don't have Windows-based computers, these are serial ports. For those of you who work at Sun, the answer to your next question is, Yes, you can have up to four serial ports.

This points out something rather annoying: Sun doesn't know all that much about Wintel machines. Now, it wouldn't be so bad for Sun to claim ignorance on this topic, but JavaSoft is supposed to be a cross-platform company, supporting everything from jewelry to supercomputers. Guess it will just have to fill in a few gaps.

Thursday night, of course, was the big JavaOne party, dubbed "Retro & Beyond." Given that somebody made 0-million on JavaOne, the party sucked. For what I was paying, I would have expected to see the Starship playing on the Retro side of the house while Nine Inch Nails blasted through the Beyond side. No such luck. At least the conversation was good, and the video games on the Retro side were fun as well. More ring discussions were pursued, and by the time I got home, just after midnight, I had a couple more tricks to try.

I moved my Blue Dot reader over to COM2 and downloaded the freshly released java.comm package from the Java Developer Connection Web site. I wrote the following simple class:

import javax.comm.*;
import java.util.*;
import java.io.*;
public class test {
   public static void main(String args[]) {
    CommPort te = null;
    for (Enumeration e = CommPortIdentifier.getPortIdentifiers(); e.hasMoreElements(); ) {
        CommPortIdentifier cp = (CommPortIdentifier) e.nextElement();
        if (cp.getName().compareTo("COM2") == 0) {
            try {
            te = cp.openPort("Test", 500);
            } catch (Exception ee) { 
                System.out.println("Port in use, sorry.\n");
                te = null;
            }
        }
        System.out.println("Available port : "+cp.getName());
    }
    if (te != null) {
        OutputStream os;
        try {
            os = te.getOutputStream();
        } catch (Exception e3) { os = null; }
        if (os == null) {
            te.closePort();
            System.exit(1);
        }
        PrintStream ps = new PrintStream(os);
        for (int i = 0; i < 10; i++) {
            ps.println("This is a test "+i);
        }
        te.closePort();
    }
   }
}


And it confirmed my fears: The Java communications framework knows only about LPT1, COM1, and COM2 on Win95 machines. Ouch. I still couldn't get the test program apduGUI to work, and I was getting desperate. I decided to try one of the others. As chance would have it, I tried the BusinessCard demo by starting up the BusinessCardDisplay class that was part of the Examples directory.

After much gnashing of teeth (and messages about timeouts and searching for drivers), I got the BusinessCard display up, and -- lo and behold! -- it found my ring and displayed my data! Success! If it weren't two in the morning I might have jumped for joy. As it was, my elation was somewhat muted. I set about fixing my card such that my coffee preference was listed as Dr. Pepper -- I don't drink coffee. I hacked the BusinessCardDisplay applet and "fixed" it such that I could store my preferences in the ring. Then off to bed.

Day 4: Disaster and redemption

I woke on day four bleary-eyed and perhaps a bit hung-over. Partying, hacking, and not sleeping are not conducive to clear thinking. I did manage, however, to struggle out of bed and get to the conference. The crowd was significantly reduced, and I checked right away to see if I could show off my new "coffee preference" on the JavaStations at the show. It worked great, much to the annoyance of the folks running the coffee shop demo. (They were taking orders by having us put our rings in their reader; then they would serve your preferred coffee. Of course, my ring ordered Dr. Pepper. Lots of laughs.)

By now the folks running the TV/set-top box thingies with Blue Dot readers had them up and running. I thought it would be neat to show off my ring modifications. Unfortunately, I hadn't bothered to check out the interface first; in fumbling around got to the back end of the personalize-your-ring page, my ring was "personalized" with the previous user's information. Yuck! Now, not only did my ring not contain my kewl new beverage preference, it didn't even look like it belonged to me!

The guys at the TVs were no help at all, so I went looking for a Dallas Semiconductor engineer. No joy there -- they were all headed to Dallas (or wherever they go when they aren't at the Moscone Center). Then I found out that the Java Lobby guys had out-hacked me. They were using the BusinessCard applet to not only modify attendee's rings, but to register folks for the Java Lobby. I took the opportunity to reprogram my ring. Of course, they hadn't added the preference hack, so I was able to reclaim my personal information, but not my Dr. Pepper preference.

JavaOne slowly wound down. I ended up getting a jewelry-style ring (one that would fit my plump digit) and went home for some much-needed sleep.

Epilogue

There is no moral to this story, except perhaps that if you don't sleep you may catch a cold (I did). Over the weekend I was able to delve deeper into the code that runs the ring. Some useful resources are the JavaCard documents on the java.sun.com Web site, and of course the two articles in this issue of JavaWorld (April 1998). And, for those of you who are electron-pushers like myself, the Dallas Semiconductor application note on the serial interface (App74) is quite interesting as well. (See the Resources section below for links to these useful resources.)

I've started playing with the crypto code and hope to have a real secret coder ring running by the time you read this. The current ring has 6 kilobytes of RAM; Dallas Semiconductor claims it could do more than 128 kilobytes in the same package. That's the ring I'd really like to see.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources
  • The iButton home page (The Java Button is a form of Crypto iButton.) http://www.ibutton.com
  • Dallas Semiconductor "Appnote 74" describes the serial programming of the iButton http://www.dalsemi.com/DocControl/PDFs/app74.pdf
  • Very useful links to figure out how to use the Java iButton http://www.ibutton.com/java.html
  • The Java smart card architecture and implementation http://java.sun.com/products/javacard/index.html
  • The Java communications framework (early access) http://developer.javasoft.com/developer/earlyAccess/communications.html
  • A finger print verifier that knows how to talk to smart cards http://www.identix.com/TLock.htm
  • "Sun's Scott McNealy and Alan Baratz discuss preliminary ruling in MS/Sun suit" (JavaWorld, April 1998) http://www.javaworld.com/javaworld/jw-04-1998/jw-04-lawsuit.html
  • "iButtonsThe first ready-to-buy 2.0 Java Card API devices" http://www.javaworld.com/javaworld/jw-04-1998/jw-04-ibuttons.html
  • "An introduction to Java Card" http://www.javaworld.com/javaworld/jw-02-1998/jw-02-javacard.html
  • "An Introduction to the Java Ring. Learn about the inner workings of this secure, durable, wearable Java-powered electronic token." http://www.javaworld.com/javaworld/jw-04-1998/jw-04-javadev.html