Click here to Skip to main content
15,507,526 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating an application that performs a task (for example, changing a value in the registry), but to do this I want to ask the user to enter his Windows PIN. For this, I want to use the Windows Hello authentication feature, the same thing that browsers use when the user wants to e.g. see their saved passwords.

The picture in the link below shows what I want to achieve in C#.

https://i0.wp.com/pureinfotech.com/wp-content/uploads/2018/11/windows-hello-prompt-microsoft-account-online.jpg?resize=827%2C541&quality=78&strip=all&ssl=1[^]

What I have tried:

I tried to use the code from this article, but it is not a window that requires a PIN, but a username and password and that is unnecessary for me.

https://stackoverflow.com/questions/4134882/show-authentication-dialog-in-c-sharp-for-windows-vista-7[^]
Posted
Updated 23-Aug-22 15:33pm
v2
Comments
rnbergren 23-Aug-22 10:22am    
The reference you point to in stack overflow will force the user authentication. If they don't have a PIN setup as their primary authentication it will go to userID and password. I believe anyway. I don't have a PIN setup.

1 solution

Okay, this was a fun quick one to research.

I started with this: windows hello authentication api - Google Search[^]

and found this Q&A: Windows Hello based Pin Authentication API for Windows Custom Credential Provider[^]

The last comment pointed to: Credential Providers in Windows 10 - Win32 apps | Microsoft Docs[^]

So then did the following search: c# windows 10 Credential Provider - Google Search[^]

Which yielded this gem (with C# source code): GitHub - SteveSyfuhs/CredProvider.NET: A Windows Credential Provider written in C#[^]

Which itself points at this blog article (with screenshots): Creating Custom Windows Credential Providers in .NET[^]

[edit] The last Google Search also yielded another C# solution: Windows Credential Provider in C# - StackOverflow[^]

Which points to this gem (also with source code): GitHub - phaetto/windows-credentials-provider: An example implementation of a windows credential provider that is tightly connected with logon system[^]

I have been verbose so you can look for alternatives if what I found is not suitable.

Hope this helps!
 
Share this answer
 
v2
Comments
Richard Deeming 24-Aug-22 11:48am    
That's some good research, but unfortunately I think you've gone down the wrong path. As far as I can see, the OP wants to prompt the user to enter their credentials using the existing Windows Hello credential providers, not write a new credential provider. :)
Graeme_Grant 24-Aug-22 14:06pm    
I read the solutions as a wrapper around the existing, not a complete new provider. I'll have another look after some sleep.
Graeme_Grant 24-Aug-22 21:20pm    
I've looked at the code for the 2 solutions that I point to. Both do exactly what the OP has asked for help with - use the OS provider dialog.

Please have another look at the GitHub repositories that are pointed to in my solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900