Cratylus
Cratylus

Reputation: 54074

java application reads data from card reader

If someone wants to write a java application that interacts with a physical device, specifically a reader (e.g. as when you go in a hotel, gym, bank etc and you pass the card through a reader and the application finds you in the database) how is this done?
Is there a java api to interact with the reader and get the cards data?
When a company creates a reader (physical device) does it provide relevant apis?
Are the physical details abstracted from the application programmer?
I need to interact with a reader in java but I do not know how to start.
Any input is highly welcome!

Thanks

Upvotes: 4

Views: 9346

Answers (3)

Lars Westergren
Lars Westergren

Reputation: 2139

Here you have generic usb drivers for smartcard readers, as well as a daemon that can detect when new readers are plugged in, and some diagnostics information when the readers initiate a connection with a smartcard (either through contact, or contactless/NFC). http://www.linuxnet.com/

jpcsc can then be used as a java API towards the card, so you can read and write. You are abstracted away from the reader hardware, but you still need to know a lot about the specifics of the smartcard - which version of Javacard/GlobalPlatform it uses, what the crypto keys are that are used if you want to establish a secure connection, etc.

Or you can buy a complete development environment including a card, a reader, and an IDE (usually based on Eclipse) from a smartcard manufacturer such as G & D, Oberthur, Gemalto...

Upvotes: 0

DarkThrone
DarkThrone

Reputation: 1964

It depends on the platform. For instance ORACLE states Java Communications 3.0 API to work with:

The Java Communications API (also known as javax.comm) provides applications access to RS-232 hardware (serial ports) and limited access to IEEE-1284 (parallel ports), SPP mode.

This could give you a starter.

Upvotes: 3

usr-local-ΕΨΗΕΛΩΝ
usr-local-ΕΨΗΕΛΩΝ

Reputation: 26874

You can start playing with the javax.smartcardio package.

It's an official Oracle product to allow smart card interaction. This doesn't solve the general problem of device communication (in Unix, simply open /dev/whatever0 with right permissions as it was a file), but may help you with your smart card scenario.

Upvotes: 4

Related Questions