System.Security.Cryptography.ProtectedData 11.0.0-preview.6.26359.118

About

System.Security.Cryptography.ProtectedData offers a simplified interface for utilizing Microsoft Windows DPAPI's CryptProtectData and CryptUnprotectData functions.

Note: Since it relies on Windows DPAPI, this package is only supported on Windows platforms. For more complex cryptographic operations or cross-platform support, consider the System.Security.Cryptography namespace.

Key Features

  • Built upon the robust and secure Windows Data Protection API (DPAPI).
  • Data can be protected either for current process or for any process on the machine.
  • Scope of protection can be defined either to the current user or the local machine.

How to Use

Utilizing this package is quite simple, and it mainly revolves around two methods: Protect and Unprotect.

Here, originalData is the data you want to protect, optionalEntropy is an additional byte array used to increase encryption complexity, and DataProtectionScope specifies whether the data protection should apply to the current user or the machine.

using System.Security.Cryptography;
using System.Text;

byte[] originalData = Encoding.UTF8.GetBytes("This is a secret");
byte[] optionalEntropy = new byte[64];
Random.Shared.NextBytes(optionalEntropy);

// To protect:
byte[] encryptedData = ProtectedData.Protect(
    originalData,
    optionalEntropy,
    DataProtectionScope.CurrentUser);

// To unprotect:
byte[] decryptedData = ProtectedData.Unprotect(
    encryptedData,
    optionalEntropy,
    DataProtectionScope.CurrentUser);

Main Types

The main type provided by this library is:

  • System.Security.Cryptography.ProtectedData

Additional Documentation

Feedback & Contributing

System.Security.Cryptography.ProtectedData is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on System.Security.Cryptography.ProtectedData.

Packages Downloads
Azure.Identity
This is the implementation of the Azure SDK Client Library for Azure Identity
30
Azure.Identity
This is the implementation of the Azure SDK Client Library for Azure Identity
31
Azure.Identity
This is the implementation of the Azure SDK Client Library for Azure Identity
35
Azure.Identity
This is the implementation of the Azure SDK Client Library for Azure Identity
39
Azure.Identity
This is the implementation of the Azure SDK Client Library for Azure Identity
277
Azure.Identity
This is the implementation of the Azure SDK Client Library for Azure Identity
641
Microsoft.Identity.Client.Extensions.Msal
This package contains extensions to Microsoft Authentication Library for .NET (MSAL.NET)
30
Microsoft.Identity.Client.Extensions.Msal
This package contains extensions to Microsoft Authentication Library for .NET (MSAL.NET)
32
Microsoft.Identity.Client.Extensions.Msal
This package contains extensions to Microsoft Authentication Library for .NET (MSAL.NET)
641
Microsoft.Identity.Client.Extensions.Msal
This package contains the public client (desktop) caching to Microsoft Authentication Library for .NET (MSAL.NET)
48
Microsoft.SqlServer.SqlManagementObjects
The SQL Server Management Objects (SMO) Framework is a set of objects designed for programmatic management of Microsoft SQL Server and Microsoft Azure SQL Database.
31
Microsoft.SqlServer.SqlManagementObjects
The SQL Server Management Objects (SMO) Framework is a set of objects designed for programmatic management of Microsoft SQL Server and Microsoft Azure SQL Database.
41
NuGet.Configuration
NuGet's configuration settings implementation.
38
NuGet.Configuration
NuGet's configuration settings implementation.
40
System.Configuration.ConfigurationManager
Provides types that support using configuration files. Commonly Used Types: System.Configuration.Configuration System.Configuration.ConfigurationManager
86
System.Configuration.ConfigurationManager
Provides types that support using configuration files. Commonly Used Types: System.Configuration.Configuration System.Configuration.ConfigurationManager
280
System.Configuration.ConfigurationManager
Provides types that support using configuration files. Commonly Used Types: System.Configuration.Configuration System.Configuration.ConfigurationManager 30ab651fcb4354552bd4891619a0bdd81e0ebdbf When using NuGet 3.x this package requires at least version 3.4.
60
System.Configuration.ConfigurationManager
Provides types that support using configuration files. Commonly Used Types: System.Configuration.Configuration System.Configuration.ConfigurationManager When using NuGet 3.x this package requires at least version 3.4.
53
System.Configuration.ConfigurationManager
Provides types that support using configuration files. Commonly Used Types: System.Configuration.Configuration System.Configuration.ConfigurationManager When using NuGet 3.x this package requires at least version 3.4.
642

https://go.microsoft.com/fwlink/?LinkID=799421

.NET 10.0

  • No dependencies.

.NET 11.0

  • No dependencies.

.NET Framework 4.6.2

  • No dependencies.

.NET Standard 2.0

Version Downloads Last updated
11.0.0-preview.6.26359.118 1 07/26/2026
11.0.0-preview.5.26302.115 3 06/16/2026
11.0.0-preview.4.26230.115 5 05/13/2026
11.0.0-preview.3.26207.106 3 04/21/2026
11.0.0-preview.2.26159.112 7 03/13/2026
11.0.0-preview.1.26104.118 7 02/16/2026
10.0.10 1 07/24/2026
10.0.9 2 06/15/2026
10.0.8 4 05/13/2026
10.0.7 3 05/05/2026
10.0.6 4 04/21/2026
10.0.5 7 03/13/2026
10.0.4 8 03/13/2026
10.0.3 10 02/16/2026
10.0.2 8 01/16/2026
10.0.1 10 12/11/2025
10.0.0 12 11/14/2025
10.0.0-rc.2.25502.107 13 10/17/2025
10.0.0-rc.1.25451.107 15 09/12/2025
10.0.0-preview.7.25380.108 16 08/22/2025
10.0.0-preview.6.25358.103 16 07/17/2025
10.0.0-preview.5.25277.114 18 06/07/2025
10.0.0-preview.4.25258.110 19 05/16/2025
10.0.0-preview.3.25171.5 18 04/26/2025
10.0.0-preview.2.25163.2 24 03/20/2025
10.0.0-preview.1.25080.5 20 02/26/2025
9.0.18 1 07/22/2026
9.0.17 2 06/15/2026
9.0.16 3 05/13/2026
9.0.15 4 04/21/2026
9.0.14 7 03/13/2026
9.0.13 8 02/16/2026
9.0.12 11 01/16/2026
9.0.11 13 11/14/2025
9.0.10 12 10/17/2025
9.0.9 14 09/11/2025
9.0.8 16 08/07/2025
9.0.7 14 07/12/2025
9.0.6 20 06/14/2025
9.0.5 15 06/27/2025
9.0.4 18 04/26/2025
9.0.3 19 03/20/2025
9.0.2 22 02/18/2025
9.0.1 22 01/18/2025
9.0.0 22 01/19/2025
9.0.0-rc.2.24473.5 24 01/19/2025
9.0.0-rc.1.24431.7 18 02/18/2025
9.0.0-preview.7.24405.7 20 02/18/2025
9.0.0-preview.6.24327.7 19 10/05/2024
9.0.0-preview.5.24306.7 15 02/18/2025
9.0.0-preview.4.24266.19 17 10/05/2024
9.0.0-preview.3.24172.9 19 02/18/2025
9.0.0-preview.2.24128.5 14 02/18/2025
9.0.0-preview.1.24080.9 21 03/19/2024
8.0.0 24 03/02/2024
8.0.0-rc.2.23479.6 21 03/08/2024
8.0.0-rc.1.23419.4 22 03/08/2024
8.0.0-preview.7.23375.6 18 03/22/2024
8.0.0-preview.6.23329.7 19 03/17/2024
8.0.0-preview.5.23280.8 21 03/18/2024
8.0.0-preview.4.23259.5 23 03/16/2024
8.0.0-preview.3.23174.8 21 03/17/2024
8.0.0-preview.2.23128.3 22 03/17/2024
8.0.0-preview.1.23110.8 19 03/15/2024
7.0.1 22 03/15/2024
7.0.0 27 03/15/2024
7.0.0-rc.2.22472.3 20 03/18/2024
7.0.0-rc.1.22426.10 25 03/18/2024
7.0.0-preview.7.22375.6 20 03/08/2024
7.0.0-preview.6.22324.4 24 03/17/2024
7.0.0-preview.5.22301.12 19 03/18/2024
7.0.0-preview.4.22229.4 20 03/08/2024
7.0.0-preview.3.22175.4 22 03/17/2024
7.0.0-preview.2.22152.2 25 03/08/2024
7.0.0-preview.1.22076.8 20 03/15/2024
6.0.2-mauipre.1.22102.15 22 03/22/2024
6.0.2-mauipre.1.22054.8 19 03/22/2024
6.0.0 275 08/18/2023
6.0.0-rc.2.21480.5 21 03/22/2024
6.0.0-rc.1.21451.13 20 03/22/2024
6.0.0-preview.7.21377.19 16 03/18/2024
6.0.0-preview.6.21352.12 25 03/20/2024
6.0.0-preview.5.21301.5 22 03/09/2024
6.0.0-preview.4.21253.7 18 03/19/2024
6.0.0-preview.3.21201.4 21 03/18/2024
6.0.0-preview.2.21154.6 19 03/20/2024
6.0.0-preview.1.21102.12 22 03/20/2024
5.0.0 643 08/18/2023
5.0.0-rc.2.20475.5 20 03/02/2024
5.0.0-rc.1.20451.14 20 03/02/2024
5.0.0-preview.8.20407.11 19 03/20/2024
5.0.0-preview.7.20364.11 21 03/19/2024
5.0.0-preview.6.20305.6 20 03/20/2024
5.0.0-preview.5.20278.1 19 03/19/2024
5.0.0-preview.4.20251.6 21 03/20/2024
5.0.0-preview.3.20214.6 20 03/19/2024
5.0.0-preview.2.20160.6 24 03/19/2024
5.0.0-preview.1.20120.5 21 03/20/2024
4.7.0 635 08/18/2023
4.7.0-preview3.19551.4 19 03/19/2024
4.7.0-preview2.19523.17 20 03/20/2024
4.7.0-preview1.19504.10 23 03/19/2024
4.6.0 23 03/16/2024
4.6.0-rc1.19456.4 22 03/22/2024
4.6.0-preview9.19421.4 19 03/09/2024
4.6.0-preview9.19416.11 19 03/02/2024
4.6.0-preview8.19405.3 18 03/02/2024
4.6.0-preview7.19362.9 23 03/22/2024
4.6.0-preview6.19303.8 18 03/09/2024
4.6.0-preview6.19264.9 21 03/20/2024
4.6.0-preview5.19224.8 19 03/18/2024
4.6.0-preview4.19212.13 20 03/18/2024
4.6.0-preview3.19128.7 19 03/22/2024
4.6.0-preview.19073.11 20 03/22/2024
4.6.0-preview.18571.3 19 02/18/2025
4.5.0 77 08/18/2023
4.5.0-rc1 23 03/20/2024
4.5.0-preview2-26406-04 20 03/20/2024
4.5.0-preview1-26216-02 21 03/09/2024
4.5.0-preview1-25914-04 22 03/19/2024
4.4.0 46 08/18/2023
4.4.0-preview2-25405-01 25 03/20/2024
4.4.0-preview1-25305-02 21 03/06/2024
4.3.0 22 03/17/2024
4.3.0-preview1-24530-04 24 03/09/2024
4.0.0 22 03/16/2024