Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I login to the windows 10 remotely by smart card With C#?

I already setup active directory to enable SmartCard logon, and could logon to the Windows through the login screen by PIN.

I'm looking to find the way to logon with new session or Unlock the active session remotely. I found http://www.pkcs11interop.net/ looks really cool tools. So I spent couple of times to read documents to find the solution. I implemented the service which could communicate remotley, also I could initialize the library and create session with login/logut, But couldn't find a way how to logon to the windows or unlock active session. Is anyone knows how I could reach this approach?

I need to do this through the C# code.

like image 950
Peyman Avatar asked Dec 06 '25 08:12

Peyman


1 Answers

I've never attempt to do it, but I point you to the documentation on MSDN:

Smart Card and Remote Desktop Services

In the specific,

Remote Desktop redirection Notes about the redirection model:

This scenario is a remote sign-in session on a computer with Remote Desktop Services. In the remote session (labeled as "Client session"), the user runs net use /smartcard.

Arrows represent the flow of the PIN after the user types the PIN at the command prompt until it reaches the user's smart card in a smart card reader that is connected to the Remote Desktop Connection (RDC) client computer.

The authentication is performed by the LSA in session 0.

The CryptoAPI processing is performed in the LSA (Lsass.exe). This is possible because RDP redirector (rdpdr.sys) allows per-session, rather than per-process, context.

The WinScard and SCRedir components, which were separate modules in operating systems earlier than Windows Vista, are now included in one module. The ScHelper library is a CryptoAPI wrapper that is specific to the Kerberos protocol.

The redirection decision is made on a per smart card context basis, based on the session of the thread that performs the SCardEstablishContext call. Changes to WinSCard.dll implementation were made in Windows Vista to improve smart card redirection.

like image 134
madduci Avatar answered Dec 10 '25 16:12

madduci



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!