Java – Accessing smart card with Java

javasmartcard

I'm trying to learn about how does Java access smart cards, due to a project analysis. I wonder if there is any kind of virtual smart card which I could use to make some tests with Java?

By the way, I've read about Java Card, and looks like it is used to run Java in cards, not to smart card data access using Java, right?

Best Answer

Look at this tutorial + example. And related. (I have used these examples and they work fine).

An important point is that you can't get anything out of the smart card. You can only send things to its processor. So whenever you get a PrivateKey object, you don't actually have the private key - this is only a proxy to the SmartCard processor, and calling methods on it, calls the processor.

I'm not aware of virtual smart cards, though.

An API of interest is javax.smartcardio