Skip to main content
net8.0net9.0net10.0

.NET wrapper to get or set private data stored in Local Security Authority (LSA)

Published
Apr 25, 2026
5mo ago
Total Downloads
10.5K
10,530

Install

dotnet add package Meziantou.Framework.Win32.Lsa --version 2.0.19
ProductVersions
.NET
net10.0net8.0net9.0

README

Meziantou.Framework.Win32.Lsa

.NET wrapper to get or set private data stored in Local Security Authority (LSA).

Usage

The LSA (Local Security Authority) private data storage is a secure Windows storage area that can be used to store sensitive data like credentials, secrets, and other private information. This library provides a simple .NET API to interact with LSA private data.

Note: Administrator privileges are required to set or remove values in LSA private data storage.

Store a value

using Meziantou.Framework.Win32;

// Requires administrator privileges
LsaPrivateData.SetValue("MySecretKey", "MySecretValue");

Retrieve a value

using Meziantou.Framework.Win32;

string? value = LsaPrivateData.GetValue("MySecretKey");
if (value != null)
{
    Console.WriteLine($"Retrieved value: {value}");
}
else
{
    Console.WriteLine("Key not found");
}

Remove a value

using Meziantou.Framework.Win32;

// Requires administrator privileges
LsaPrivateData.RemoveValue("MySecretKey");

Additional Resources

Changes from Previous Version

No structural changes between v2.0.18 and v2.0.19.

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 3 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.