Using Microsoft Password (Windows Hello), a user is given a public/private keypair when they set up a PIN for their local account. This keypair is stored on the computer's TPM.
You can create a certificate for your account by asking the Start Menu to "Set up PIN Sign-in".
The following article describes the APIs used in a UWP ("Metro") app: https://msdn.microsoft.com/en-us/windows/uwp/security/microsoft-passport
There are APIs for fetching the user's public key, and signing a message:
var openKeyResult = await KeyCredentialManager.OpenAsync(AccountId);
if (openKeyResult.Status == KeyCredentialStatus.Success)
{
var userKey = openKeyResult.Credential;
var publicKey = userKey.RetrievePublicKey();
var signResult = await userKey.RequestSignAsync(message);
if (signResult.Status == KeyCredentialStatus.Success)
{
return signResult.Result;
}
else if (signResult.Status == KeyCredentialStatus.UserPrefersPassword)
{
}
}
How do I fetch the public key and sign a message using a desktop app (Win32)?
I have checked using certmgr.msc
: the Microsoft Passport certificate sadly does not appear in the user's "Personal" certificate store, so I can't see a way to access it using the CryptoAPI/CNG, which my app already supports.
Ideally I would like to make a standalone signature. It would be interesting/useful to know if it's possible to use the Passport certificate with SChannel as a client certificate.