SecureConfig.Extensions
1.0.139
dotnet add package SecureConfig.Extensions --version 1.0.139
NuGet\Install-Package SecureConfig.Extensions -Version 1.0.139
<PackageReference Include="SecureConfig.Extensions" Version="1.0.139" />
<PackageVersion Include="SecureConfig.Extensions" Version="1.0.139" />
<PackageReference Include="SecureConfig.Extensions" />
paket add SecureConfig.Extensions --version 1.0.139
#r "nuget: SecureConfig.Extensions, 1.0.139"
#:package SecureConfig.Extensions@1.0.139
#addin nuget:?package=SecureConfig.Extensions&version=1.0.139
#tool nuget:?package=SecureConfig.Extensions&version=1.0.139
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.
Core Package Always required.
dotnet add package SecureConfig.CoreDependency Injection (DI) Extension Package Required for easy configuration in ASP.NET Core.
dotnet add package SecureConfig.ExtensionsAzure 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:
- Email: support@example.com
- WhatsApp: Connect with me on WhatsApp
- LinkedIn: My LinkedIn Profile
- Telegram: Join my Telegram Channel
| Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.8)
- SecureConfig.Core (>= 1.0.139)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.