Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Windows Credentials in Credential Manager

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.

like image 674
Paolo Tedesco Avatar asked Mar 23 '15 15:03

Paolo Tedesco


People also ask

Can you view passwords in credential Manager?

The Windows Credential Manager is a hidden desktop app that stores account information, including the passwords you enter when you're using Microsoft Edge or Internet Explorer. The tool also saves credential information you won't be able to view, like authentication tokens created by apps and network services.

Where are Windows credentials stored?

Application and network credentials are stored in the Windows Credentials locker. Credential Lockers store credentials in encrypted . vcrd files, located under %Systemdrive%\Users\\[Username]\AppData\Local\Microsoft\\[Vault/Credentials]\ .


1 Answers

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);
like image 60
Roenne Avatar answered Oct 20 '22 09:10

Roenne