如何在 Java 中与智能卡交互?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3823358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 03:32:37  来源:igfitidea点击:

How to interact with a smart card in Java?

javasmartcardsmartcard-reader

提问by Q8Y

Is there is a library (API) in Java with which I can interact with a smart card? Similar to the WinSCard library.

Java 中是否有可以与智能卡交互的库 (API)?类似于 WinSCard 库。

I need to be able to connect with the smart card and read data from it. I need to implement it in Java so that I can use it under any OS (Linux, Mac, Windows). Since, the WinSCard library only works under Windows because it uses a DLL (WinSCard.dll).

我需要能够连接智能卡并从中读取数据。我需要用 Java 实现它,以便我可以在任何操作系统(Linux、Mac、Windows)下使用它。因为 WinSCard 库只能在 Windows 下工作,因为它使用 DLL ( WinSCard.dll)。

Is there anything as good as WinSCard in Java?

Java 中有什么和 WinSCard 一样好的东西吗?

回答by jmones

One of the solutions is to use Java? Smart Card I/O API. See the "Description"section for a simple usage example.

解决方案之一是使用Java?智能卡 I/O API。有关简单的使用示例,请参阅“说明”部分。

回答by Kartoch

The basic API is the Smartcard IO, which offer basic operation to send APDU to the card. After this, there is several higher API available. For instance, if you need to connect to a JavaCard to manage applet, you need a Global Platform implementation, for instance the Opal Library(Shameless Self-promotion).

基本 API 是Smartcard IO,它提供向卡发送 APDU 的基本操作。在此之后,有几个更高的 API 可用。例如,如果您需要连接到 JavaCard 来管理小程序,则需要一个全局平台实现,例如Opal 库(无耻的自我提升)。

回答by user4935264

PC/SC specification as a reader and a satandard interface between card and computer.Open the VC support PC/SC standard key header file WinScard.h. With java can call the PC/SC of VC.As a middle way to solve you problems.

PC/SC 规范作为读卡器和卡与计算机之间的标准接口。打开 VC 支持 PC/SC 标准密钥头文件 WinScard.h。用java可以调用VC的PC/SC,作为解决你问题的中道。