使用Java访问智能卡
由于项目分析,我正在尝试了解 Java 如何访问智能卡。我想知道是否有任何类型的虚拟智能卡可以用来用 Java 进行一些测试?
顺便说一句,我读过有关 Java Card 的内容,看起来它是用于在卡中运行 Java,而不是使用 Java 访问智能卡数据,对吧?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Java Card 开发套件 捆绑了一个 Java Card 模拟器。如果您计划在某个阶段使用真正的卡,请获取版本 2.2.1 或 2.2.2,因为我暂时不会期望任何版本 3 的卡。您仍然需要一个小程序才能将其添加到卡上。 java 卡本身不执行任何操作。直到您加载卡片小程序后,它才会执行任何有用的功能。
JCDK 中模拟器的一个问题是您无法使用 javax.smartcardio 访问卡,而这是目前与卡通信的首选方法。另一种流行的替代方案 OpenCard Framework 已经有一段时间没有得到积极维护了。
There is a Java Card emulator bundled with the Java Card Development Kit. If you plan on using a real card at some stage, get version 2.2.1 or 2.2.2 as I would not expect any version 3 cards for a while. You will still need an applet to put on the card. A java card does nothing by itself. It isn't until you load a card applet that it will perform any useful function.
One problem with the emulator in the JCDK is that you cannot use javax.smartcardio to access the card and this is the prefered method at the moment for communicating with a card. The other popular alternative, OpenCard Framework, has not been actively maintained in some time.
您可以在此处获取虚拟智能卡(和虚拟读卡器):http://sourceforge.net/projects/vsmartcard/
You can get a virtual smartcard (and a virtual reader) here: http://sourceforge.net/projects/vsmartcard/
Javacard使用Java只是Java开发的一个子集 你最好不要使用Java开发环境 因为有一些特殊效果是不支持的
您可以下载插件或者专用的开发IDE,可以从这里www.javacos.com下载相关的开发环境。
Javacard use Java only a subset of the Java development You'd better not use Java development environment Because there are some special effects is not support
You can download the plugin or a dedicated development IDE, you can download it from here www.javacos.com related development environment.
如果您需要模拟 JavaCard,请尝试使用 jCardSim:http://jcardsim.org。
它还支持通过 javax.smartcardio API 和 apdu 脚本进行访问。
If you need to emulate JavaCard try to use jCardSim: http://jcardsim.org.
It also supports access via javax.smartcardio API and apdu-scripts.
看看在本教程+示例中。以及相关。 (我已经使用了这些例子并且它们工作得很好)。
重要的一点是您无法从智能卡中获取任何内容。你只能将东西发送到它的处理器。因此,每当您获得
PrivateKey
对象时,您实际上并没有私钥 - 这只是智能卡处理器的代理,调用它的方法就会调用处理器。不过,我不知道虚拟智能卡。
感兴趣的 API 是
javax.smartcardio< /代码>
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