Skip to main content
net10.0net11.0

C# wrapper around CredWrite/CredRead/CredDelete/CredUIPromptForWindowsCredentials/CredUICmdLinePromptForCredentials functions to store and retrieve from Windows Credential Store

Published
Oct 28, 2026
21d ago
Total Downloads
3.7M
3,742,321

Install

dotnet add package Meziantou.Framework.Win32.CredentialManager --version 3.0.8
ProductVersions
.NET
net10.0net11.0

README

Meziantou.Framework.Win32.CredentialManager

Read, write, and delete the credentials of the Windows Credential Manager. CredentialManager is in the Meziantou.Framework.Win32 namespace.

// Save the credential to the credential manager
CredentialManager.WriteCredential(
    applicationName: "CredentialManagerTests",
    userName: "meziantou",
    secret: "Pa$$w0rd",
    comment: "Test",
    persistence: CredentialPersistence.LocalMachine);

// Get a credential from the credential manager.
// ReadCredential returns null when no such credential exists.
var cred = CredentialManager.ReadCredential(applicationName: "CredentialManagerTests");
if (cred is not null)
{
    Console.WriteLine(cred.UserName);
    Console.WriteLine(cred.Password);
}

// Delete a credential from the credential manager.
// DeleteCredential throws Win32Exception when no such credential exists.
CredentialManager.DeleteCredential(applicationName: "CredentialManagerTests");

Additional resources

Changes from Previous Version

No structural changes between v3.0.7 and v3.0.8.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.