Using the Windows.Security.Credentials.PasswordVault
class, I can access the passwords stored under "Web Credentials" in the Windows Credential Manager:
using System;
using Windows.Security.Credentials;
class Program {
static void Main(string[] args) {
PasswordVault vault = new PasswordVault();
foreach (var cred in vault.RetrieveAll()) {
cred.RetrievePassword();
Console.WriteLine("Resource: {0}", cred.Resource);
Console.WriteLine("UserName: {0}", cred.UserName);
Console.WriteLine("Password: {0}", cred.Password);
}
}
}
I would like to know if there's a way to retrieve the credentials stored under "Windows Credentials" instead.
There is a Nuget library called CredentialManagement http://nuget.org/packages/CredentialManagement/ from the answer here: Retrieve Credentials from Windows Credentials Store using C#
works perfectly
var cm = new Credential();
cm.Target = "mycredentialname";
if (!cm.Exists())
{
Console.WriteLine("cm is null");
}
cm.Load();
Console.WriteLine("Password: " + cm.Password);
Console.WriteLine("Username: " + cm.Username);