如何通过读卡器使用Java激活/开机ICC卡?

发布于 2024-12-25 13:52:18 字数 528 浏览 3 评论 0原文

我正在编写一个应用程序来与当前使用 Java 的智能卡进行交互。我有一个欧姆龙V2BF系列读卡器。该应用程序在 Debian 上运行。

我尝试过使用 Java 智能卡 I/O API 尝试建立与智能卡的连接。

但我无法检测/获取任何卡终端,

    TerminalFactory factory = TerminalFactory.getDefault();
    List<CardTerminal> terminals = factory.terminals().list();

我还尝试通过向欧姆龙读卡器发送命令包来使用“按下并激活(冷重置)ICC”,但响应始终为“否定”。

我可以知道我做错了哪一部分吗?任何建议将不胜感激!

I am writing an application to interact with smart card currently using Java. I have a OMRON V2BF series card reader. The application is run on Debian.

I have tried using Java Smart Card I/O API to try to establish connection to the smart card.

But I couldn't detect/get any card terminals using

    TerminalFactory factory = TerminalFactory.getDefault();
    List<CardTerminal> terminals = factory.terminals().list();

I also tried using "Press and activate(cold reset) ICC" by sending a command packet to OMRON reader, but the response is always "Negative".

May I know which part I did wrongly? Any advice would be greatly appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

靑春怀旧 2025-01-01 13:52:18

factory.terminals().list() 默认情况下只会显示 PCSC 兼容设备。我没有看到任何有关当前读者的 PCSC 支持的信息。请查阅文档或咨询供应商。

您的智能卡应该是 ISO 7816-4 兼容的智能卡才能与 javax.smartcardio 一起使用,存储卡将不起作用。 javax.smartcardio 基本上与 CommandAPDU 和 ResponseAPDU 一起使用,它们是“处理器”卡的 ISO 7816-4 兼容数据结构。

您可能无法使用读卡器制造商提供的接口规范通过串行接口与读卡器进行通信。您可以使用 Java Communications API 来执行此操作。

请注意,许多制造商将提供 C/C++ 甚至 .NET 中的示例代码和库,在这种情况下,可以选择切换编程语言/平台或围绕本机代码创建 JNI 包装器。

如果您正在为处理器卡(例如信用卡)编写,您甚至可以自己创建一个 javax.smartcardio 兼容终端并将其插入终端列表中。

factory.terminals().list() will only show you PCSC compatible devices by default. I don't see any information on PCSC support for the current reader. Please consult the documentation or the supplier for that.

Your smart card should be a ISO 7816-4 compatible smart card to work with javax.smartcardio, memory cards won't work. javax.smartcardio is basically for use with CommandAPDU and ResponseAPDU, which are ISO 7816-4 compatible data structures for "processor" cards.

You may be stuck with communicating with the reader through the serial interface using the interface specification delivered by the reader manufacturer. You can use the Java Communications API to do that.

Note that many manufacturers will supply sample code and libs in C/C++ or even .NET, in that case it may be an option to switch programming language/platform or create a JNI wrapper around the native code.

If you are writing for a processor card (e.g. credit card) you may even create a javax.smartcardio compatible Terminal yourself and insert it into the terminal list.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文