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?
This Java sample code describes the Java Smart Card I/O API used to get access to a common smart card. It demonstrates the communication with smart cards using APDUs specified in ISO/IEC 7816-4. It thereby allows Java applications to interact with applications running on the smart card.
It thereby allows Java applications to interact with applications running on the smart card. The Application Programming Interface (API) for the Java Card technology defines the communication protocol conventions by which an application accesses the Java Card Runtime Environment and native services.
Off the card, residing in a card terminal, the host application accesses applets on the smart card using one of a number of interfaces for card access, such as the Java Card RMI, the OpenCard Framework API, or the Security and Trust Services API (SATSA).
You can use either of two models for communication between a host application and a Java Card applet. The first model is the fundamental message-passing model, and the second is based on Java Card Remote Method Invocation (JCRMI), a subset of the J2SE RMI distributed-object model.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With