SecureConfig.Extensions 1.0.139

dotnet add package SecureConfig.Extensions --version 1.0.139
                    
NuGet\Install-Package SecureConfig.Extensions -Version 1.0.139
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SecureConfig.Extensions" Version="1.0.139" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SecureConfig.Extensions" Version="1.0.139" />
                    
Directory.Packages.props
<PackageReference Include="SecureConfig.Extensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SecureConfig.Extensions --version 1.0.139
                    
#r "nuget: SecureConfig.Extensions, 1.0.139"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SecureConfig.Extensions@1.0.139
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SecureConfig.Extensions&version=1.0.139
                    
Install as a Cake Addin
#tool nuget:?package=SecureConfig.Extensions&version=1.0.139
                    
Install as a Cake Tool

SecureConfig

A .NET library for securely and flexibly managing application settings and sensitive data.

SecureConfig is a set of lightweight libraries that empower developers to manage sensitive application settings (like connection strings and API keys) in a secure and flexible manner. It's designed to be highly customizable, allowing you to store secrets in various sources such as appsettings.json, environment variables, or Azure Key Vault.


🚀 Key Features

  • Superior Security: Store sensitive data in an encrypted format.
  • Flexible Configuration: Support for multiple key and secret providers.
  • Seamless Integration: Integrates easily with ASP.NET Core's built-in Dependency Injection (DI) system.
  • Extensible: You can create custom providers to support any data source.

📦 Installation

You can install the packages from NuGet using the dotnet add package command.

  1. Core Package Always required.

    dotnet add package SecureConfig.Core
    
  2. Dependency Injection (DI) Extension Package Required for easy configuration in ASP.NET Core.

    dotnet add package SecureConfig.Extensions
    
  3. Azure Key Vault Integration Package If you're using Azure Key Vault to store your encryption key.

    dotnet add package SecureConfig.Azure.KeyVault
    

🛠️ Usage Examples

1. appsettings.json (For Local Development)

First, encrypt your sensitive data and place it, along with the encryption key, in appsettings.json.

{
  "ConnectionStrings": {
    "DefaultConnection": "YOUR_ENCRYPTED_CONNECTION_STRING"
  },
  "SecureConfig": {
    "EncryptionKey": "my-local-secret-key-for-testing"
  }
}

Second, in your Program.cs file, configure the service.

// Program.cs
using SecureConfig.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddSecureConfigWithAppSettings(
    builder.Configuration,
    "SecureConfig:EncryptionKey"
);

// ... (rest of the code)

2. Environment Variables (For Production)

First, store the encryption key as an environment variable on your server.

Second, in your Program.cs file, configure the service to read from environment variables.

// Program.cs
using SecureConfig.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddSecureConfigWithEnvironmentVariables(
    builder.Configuration,
    "ASPNETCORE_ENCRYPTION_KEY" // The name of the environment variable
);

// ... (rest of the code)

3. Azure Key Vault (The Most Secure Option)

First, store your encryption key as a Secret in Azure Key Vault and grant your application's Managed Identity access.

Second, in your Program.cs file, configure the service to connect to the vault.

// Program.cs
using SecureConfig.Azure.KeyVault;

var builder = WebApplication.CreateBuilder(args);

var keyVaultUrl = builder.Configuration["AzureKeyVault:Url"];
var secretName = "MyEncryptionKey";

builder.Services.AddSecureConfigWithAzureKeyVault(keyVaultUrl, secretName);

// ... (rest of the code)

📝 Practical Example

After configuration, you can inject ISecureConfigManager anywhere in your application.

using Microsoft.AspNetCore.Mvc;
using SecureConfig.Core;

public class HomeController : Controller
{
    private readonly ISecureConfigManager _secureConfig;

    public HomeController(ISecureConfigManager secureConfig)
    {
        _secureConfig = secureConfig;
    }

    public async Task<IActionResult> Index()
    {
        // The library handles decryption automatically
        var connectionString = await _secureConfig.GetSettingAsync("ConnectionStrings:DefaultConnection");
        ViewBag.DbConnection = connectionString;
        return View();
    }
}

🤝 Contributing

We welcome contributions to this library. Feel free to submit suggestions or report bugs via GitHub.


📞 Get in Touch

If you have any questions or would like to discuss the tool, you can reach out to me via:

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.139 165 9/6/2025
1.0.138 154 9/6/2025
1.0.137 148 9/6/2025
1.0.136 150 9/6/2025
1.0.135 156 9/6/2025
1.0.134 137 9/5/2025
1.0.133 135 9/5/2025