Subject: (pwd)Extension-Mgr/SECKfmSwitchToIDFile and SMARTCARDS
A smartcard protected ID file cannot be unlocked with SECKFMSwitchToIDFile, and the extension manager will not be called for a smartcard-protected ID. You can SECManipulateSC to log in to a smartcard-enabled ID file. Here’s some fairly sloppy pseudocode for SECManipulateSC. As always, real code should check for errors and actually do something with return values. 
error = SECManipulateSC (SC_manip_GetVersion,
NULLSCMCTX,
NULL,
&Version,
NULL);
/* Initialize the PKCS#11 context.
*/
error = SECManipulateSC (SC_manip_InitializeContext,
&Context,
NULL, NULL, NULL);
/* Set up the ID file
*/
error = SECManipulateSC (SC_manip_EnterIDFile,
&Context,
NULL,
&dwIDLen,
IDPath);
/* Unlock the smartcard
*/
error = SECManipulateSC (SC_manip_EnterPIN,
&Context,
NULL,
&dwPINLen,
PIN);
/* Note – SC_manip_EnterPIN will use an external authentication path if it exists. If the token doesn’t support a protected authentcation path, SC_manip_EnterPIN will use the supplied PIN if one exists or generate a prompt if a NULL or zero-length PIN was used. */
…
/* Clean up
*/
SECManipulateSC (SC_manip_TerminateContext,
&Context,
NULL, NULL, NULL);