简体   繁体   English

Java应用程序从读卡器读取数据

[英]java application reads data from card reader

If someone wants to write a java application that interacts with a physical device, specifically a reader (eg 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? 如果某人想编写一个与物理设备(特别是读卡器)交互的Java应用程序(例如,当您进入旅馆,健身房,银行等时,将卡通过读卡器,然后该应用程序在数据库中找到您)完成了吗
Is there a java api to interact with the reader and get the cards data? 是否有Java API与阅读器进行交互并获取卡数据?
When a company creates a reader (physical device) does it provide relevant apis? 公司创建阅读器(物理设备)时是否提供相关的api?
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. 我需要与Java中的阅读器进行交互,但是我不知道如何开始。
Any input is highly welcome! 任何输入都非常欢迎!

Thanks 谢谢

You can start playing with the javax.smartcardio package. 您可以开始使用javax.smartcardio软件包。

It's an official Oracle product to allow smart card interaction. 这是允许智能卡交互的Oracle官方产品。 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. 这不能解决设备通信的一般问题(在Unix中,只需以适当的权限打开/dev/whatever0 ,因为它是一个文件),但是可以帮助您解决智能卡问题。

It depends on the platform. 这取决于平台。 For instance ORACLE states Java Communications 3.0 API to work with: 例如,ORACLE声明Java Communications 3.0 API可用于:

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. Java Communications API(也称为javax.comm)为应用程序提供了对RS-232硬件(串行端口)的访问权限,以及对IEEE-1284(并行端口)SPP模式的有限访问权限。

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). 在这里,您具有用于智能卡读取器的通用USB驱动程序,以及可以检测何时插入新读取器的守护程序,以及当读取器启动与智能卡的连接(通过接触式或非接触式/ NFC)时的一些诊断信息。 http://www.linuxnet.com/ http://www.linuxnet.com/

jpcsc can then be used as a java API towards the card, so you can read and write. 然后,jpcsc可用作卡的Java API,因此您可以读写。 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. 您从阅读器硬件中脱颖而出,但是您仍然需要了解很多有关智能卡的细节-智能卡使用哪个版本的Javacard / GlobalPlatform,如果要建立安全连接,将使用什么加密密钥,等等

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... 或者,您可以从G&D,Oberthur,Gemalto等智能卡制造商那里购买包括卡,读取器和IDE(通常基于Eclipse)的完整开发环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM