简体   繁体   English

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

[英]How to activate/power on ICC card using Java through card reader?

I am writing an application to interact with smart card currently using Java. 我正在编写一个应用程序来与目前使用Java的智能卡进行交互。 I have a OMRON V2BF series card reader. 我有一台OMRON V2BF系列读卡器。 The application is run on Debian. 该应用程序在Debian上运行。

I have tried using Java Smart Card I/O API to try to establish connection to the smart card. 我尝试使用Java智能卡I / O API尝试建立与智能卡的连接。

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". 我还尝试通过向OMRON阅读器发送命令包来“按下并激活(冷复位)ICC”,但响应总是“否定”。

May I know which part I did wrongly? 我可以知道我做错了哪一部分? Any advice would be greatly appreciated! 任何建议将不胜感激!

factory.terminals().list() will only show you PCSC compatible devices by default. factory.terminals().list()默认只显示PCSC兼容设备。 I don't see any information on PCSC support for the current reader. 我没有看到有关当前阅读器的PCSC支持的任何信息。 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. 您的智能卡应该是与ISO 7816-4兼容的智能卡,以便与javax.smartcardio配合使用,存储卡将无法使用。 javax.smartcardio is basically for use with CommandAPDU and ResponseAPDU, which are ISO 7816-4 compatible data structures for "processor" cards. javax.smartcardio基本上用于CommandAPDU和ResponseAPDU,它们是“处理器”卡的ISO 7816-4兼容数据结构。

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. 您可以使用Java Communications API来执行此操作。

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. 请注意,许多制造商将提供C / C ++甚至.NET中的示例代码和库,在这种情况下,它可能是切换编程语言/平台或围绕本机代码创建JNI包装器的选项。

If you are writing for a processor card (eg credit card) you may even create a javax.smartcardio compatible Terminal yourself and insert it into the terminal list. 如果您正在为处理器卡(例如信用卡)编写,您甚至可以自己创建一个兼容javax.smartcardio的终端并将其插入终端列表中。

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

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