Java - how to detect smartcard hotplug

此生再无相见时 提交于 2019-12-30 10:49:05

问题


I load dynamically pkcs11 security Provider in java and it works as long as the smart card reader is inserted before running the application. Could anyone please tell me how to detect a smartcard hotplug when the application is running? Actually I need something like pcsc_scan in java. The environment is Ubuntu 9.10 with java 1.6.0_20. Thanks in advance


回答1:


PKCS#11 doesn't define a standard way to actively notify the application about device insertion/removal. The best you can do is to run a thread which will check the number of slots and their state once a second or so.




回答2:


Can you use the javax.smartcardio.* API in conjunction with PKCS #11?

The CardTerminal class has isCardPresent(), waitForCardPresent(timeout), and waitForCardAbsent(timeout) methods which can be used in a seperate thread to poll for card insertion events.



来源:https://stackoverflow.com/questions/3549633/java-how-to-detect-smartcard-hotplug

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!