Hello @Jamal ,
Thank you for providing such a detailed overview of your implementation.
I believe the software KSP approach for interactive logon faces an architectural limitation with the Local Security Authority (LSASS). The official architectural overview on How Smart Card Sign-in Works in Windows outlines how physical cards operate, but implicitly, the pre-logon phase executes under the SYSTEM authentication context. Because of this, LSASS might not be able to interact with a user's DPAPI-protected private key in the Current User store before the actual session is established. Hardware tokens process this independently, which might explain why they succeed where a software KSP fails.
Regarding the ERROR_INVALID_PARAMETER (0x57), this often points to IPC serialization constraints rather than a direct KSP rejection. While the KERB_CERTIFICATE_UNLOCK_LOGON documentation details the struct members, the LSA subsystem typically expects a strictly flat, contiguous memory buffer when passing structures to the authentication package. If the payload relies on standard memory pointers for strings instead of precise relative offsets within a single allocated block, the subsystem tends to reject it immediately.
If the SYSTEM versus User-space hurdle proves unviable for the automated environment, exploring TPM Virtual Smart Cards might be a practical alternative. Windows treats a TPM VSC as an always-inserted physical smart card, aligning with pre-logon LSASS requirements. The Virtual Smart Card Overview details this functionality, and its deployment can still be fully automated using built-in tools like tpmvscmgr.exe without needing physical hardware.
I hope this provides some helpful direction for your design. Let me know if you have any questions. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.