Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List all smartcard slots in Java

How can I search through all available slots in the machine so I can get each keystore for each slot, in Java?

like image 716
marcelo-ferraz Avatar asked Aug 10 '26 14:08

marcelo-ferraz


2 Answers

As I've found, there is this a way:

PKCS11 p11 = PKCS11.getInstance("/usr/local/lib/libsiecap11.so", "C_GetFunctionList", null, false); 
long[] slots = p11.C_GetSlotList(true);  

thanks to this question

like image 175
marcelo-ferraz Avatar answered Aug 13 '26 03:08

marcelo-ferraz


This is not a very precise question.

If you are not precise, then the "most probable" solution is http://download.oracle.com/javase/6/docs/jre/api/security/smartcardio/spec/javax/smartcardio/CardTerminals.html

But you seem to be talking about PKCS#11 (which is NOT the direct mapping of a smart card hardware "slot")

like image 35
Martin Paljak Avatar answered Aug 13 '26 03:08

Martin Paljak