Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing smart card with Java

Tags:

java

smartcard

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?

like image 998
The Student Avatar asked May 12 '10 13:05

The Student


People also ask

What is Java smart card I/O API?

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.

How does the Java Card work?

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.

How does a host application access a smart card?

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).

How do I communicate with a Java Card applet?

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.


1 Answers

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

like image 167
Bozho Avatar answered Nov 14 '22 23:11

Bozho