Add a #FingerPrint reader to a C# WinForms app

Probably a good way to add extra security to a Windows Form app, just to make sure that there is a real human user infront of the screen, and it’s not some bot trying to interact with your software, is to add a Fingerprint / “Windows Hello” login. Of course, in the real world, generally the attacker would probably try to de-compile your software and try to attack whatever underlying API you are using. However, this is a very visible security feature, and if you’re looking for a super-quick security addition, then, this may be an interesting addition.
Windows Hello is a biometric authentication feature that allows users to log into their Windows device using a fingerprint scanner, facial recognition, or other biometric methods, rather than a password.
Some potential use cases for including Windows Hello in a WinForms app include:
- Secure login: By using a fingerprint scanner or other biometric method, you can add an additional layer of security to your app and make it more difficult for unauthorized users to access the app.
- Convenience: Allowing users to log in with a fingerprint or other biometric method can make the login process more convenient for them, as they don’t have to remember a password or enter it manually.
- Compliance: Depending on the nature of the app and the industries it serves, biometric authentication may be required by compliance regulations or industry standards.
- User experience: For some users, biometric authentication is a preferred way to interact with their devices, and they feel more secure with that kind of security.
- Protecting sensitive data: If your app handles sensitive information, such as financial data or personal information, biometric authentication can help ensure that only authorized users have access to this information.
Here is a link to a public GitHub Repo that shows a simple example of this in action: https://github.com/infiniteloopltd/FingerPrintReader
The Key code being;
var supported = await KeyCredentialManager.IsSupportedAsync();
if (!supported) return;
var result =
await KeyCredentialManager.RequestCreateAsync("login",
KeyCredentialCreationOption.ReplaceExisting);
if (result.Status == KeyCredentialStatus.Success)
{
MessageBox.Show("Logged in.");
}
else
{
MessageBox.Show("Login failed.");
}