tags:

views:

417

answers:

1

I'm using a PKCS#11 usb device to create a SSLContext. The project is migrating from an IAIK jce implementation to sun's, iaik provide a tokenmanager to detect when the token is removed, inserted, could not find a way to do this with sun implementation.

Any ideas?

A: 

Sun PKCS#11 provider creates a TokenPoller which tries to detect the token addition and removal removal.You can do the same. You can get a reference to the PKCS11 object using the PKCS11.getInstance() method passing in the library path that you used to create the provider. Be careful though, since the library path case has to be the same (its non canoncalized). Call C_GetSlotList on it passing a null. An exception indicates token removal. Reinsertion is however not reflected in this.

Kapil