How to access the stored credentials (PasswordVault?) on Win7 and Win8?

Konrad Viltersten picture Konrad Viltersten · Feb 11, 2013 · Viewed 10.8k times · Source

I just discovered that Win8 has a section on the Control Panel called User Accounts and Family Safely with Credential Manager. I'd like to access the credentials stored in there (not to retrieve the passwords but to use them as tokens for a login). So, basically, I'd like to get a piggy-back ride on already installed software.

The closest to a solution has been suggested in this discussion and it's not that close.

  1. Where do I find the assembly for Windows.Security.Credentials.PasswordVault? I've been googling for two hours but I only get information on app development while I'll be targeting desktop.

  2. Is there a way to resolve access to the pre-stored credentials for both Win7 and Win8? I fear a little bit that the vault facility has been drastically remodeled in Win8, making it impossible to target both platforms at once.

Answer

Alex Filipovici picture Alex Filipovici · Feb 11, 2013

How to: Add or Remove References By Using the Reference Manager says:

In the desktop projects the Core tab doesn’t appear by default. You can add the Windows Runtime by opening the shortcut menu for the project node, choosing Unload Project, adding the following snippet, and re-opening the project (on the project node choose Reload Project). When you invoke the Reference Manager dialog box, the Core tab appears.

<PropertyGroup>
    <TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>

Make sure to check the Windows box on this tab. You should then be able to use WinRT elements.