开发者

java application reads data from card reader

开发者 https://www.devze.com 2023-02-04 04:59 出处:网络
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

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 w开发者_如何学JAVAith 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


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消