Windows 10 Credential Provider with C#
Asked Answered
H

2

6

I am working on implementing a Credential Provider in C#.

I have downloaded the V2 Credential Provider sample in C++, which is for Windows 8, and managed to make it work on my Windows 10 PC. I also looked into this credential provider implementation in .NET https://github.com/SteveSyfuhs/CredProvider.NET, but this is for the CredUI scenario.

I have managed to make my credential provider to be displayed under "Sign-in options" of a user's tile, but now I would like to implement the login part.

I have to implement the GetSerialization method for the Logon/Unlock scenario. In the C++ sample this is already implemented, but I have troubles "translating" it into C# code, since I am not familiar with C++.

Does anyone know where I could find a working implementation of this method in C# for the Logon/Unlock scenario? Any help would be very appreciated.

Heterogeneous answered 5/1, 2018 at 11:37 Comment(0)
R
1

I see that you're familiar only with C# and you want to use that only for the CP you're working on.
I have worked on CP with c++ though I would have preferred to use C# too which am more agile with.

Implementing the Lock/Unlock isn't fully implemented in the C++ sample as you expressed. You have to intercept the code in the right place to add additional rules/ features in your project. Anyway, you can paste some codes and let's look into it together.

Robbynrobe answered 12/1, 2018 at 10:7 Comment(4)
I have managed to make the logon/unlock scenario work for my case by using the implementation of GetSerialization method for a credential tile from: github.com/phaetto/windows-credentials-provider. I had to make some changes to it in order to use the username for which the tile is and the password provided by me, but it the end it worked. Thank you very much anyhow!Heterogeneous
@SimonaCatana can you please elaborate on how you got the unlock scenario to work? I am using that same Github project to write a CP on Windows 10 and I am having trouble associating the current user to the tile for the unlock scenario.Shiftless
It's good to hear you've sorted out the logon/unlock scenario @SimonaCatana. You can shed more light on your implementation to help others.Robbynrobe
For credential serialization for Kerberos, you can see the serialization helper code in the pGina project.Nu
K
1

You have to write KerbInteractiveUnlockLogonInit and KerbInteractiveUnlockLogonPack methods in C++ and use it with DllImport from your C# project. According to CREDENTIAL_PROVIDER_USAGE_SCENARIO, you need to set MessageType property of KERB_INTERACTIVE_LOGON struct. You can get methods from here.

Kill answered 22/1, 2023 at 0:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.