How can I search through all available slots in the machine so I can get each keystore for each slot, in Java?
Asked
Active
Viewed 4,835 times
2
-
As I've found just now, I can do that. – marcelo-ferraz Oct 11 '11 at 15:18
-
thanks to http://stackoverflow.com/questions/3549633/java-how-to-detect-smartcard-hotplug – marcelo-ferraz Oct 11 '11 at 15:18
-
I just added a plus to that question. – marcelo-ferraz Oct 11 '11 at 15:18
3 Answers
9
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

Community
- 1
- 1

marcelo-ferraz
- 3,147
- 4
- 38
- 55
2
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")

Martin Paljak
- 4,119
- 18
- 20
-
If you check the tags, you will see that it has pkcs11 in it. Not a bad question at all – marcelo-ferraz Oct 19 '11 at 14:45
-