i know it's possible to validate user's Windows (e.g. domain) credentials programatically using:
LogonUser(username, password)
- from .NET ValidateCredentials(username, password)
- or the SSPI API directly
There has come a time when i want to persist those credentails.
i'm using the Data Protection API (via the CredUI API) to encrypt the password. This means that the encrypted data can only be accessed by the user themselves. My program, running as the user, can then decrypt the protected data.
But it also means that a malicious program running as the user can decrypt the protected data; stealing the user's encrypted credentials.
i know that Windows itself does not store the user's password
. What they store is the salted and hashed version of the password; and forms the "shared secret" between the user and Windows.
Is there an API that lets me ask Windows if a user's password is valid, when i know the salted hash of the password?