AgileTech.DbConnStringCrypto
1.0.0
See the version list below for details.
dotnet add package AgileTech.DbConnStringCrypto --version 1.0.0
NuGet\Install-Package AgileTech.DbConnStringCrypto -Version 1.0.0
<PackageReference Include="AgileTech.DbConnStringCrypto" Version="1.0.0" />
<PackageVersion Include="AgileTech.DbConnStringCrypto" Version="1.0.0" />
<PackageReference Include="AgileTech.DbConnStringCrypto" />
paket add AgileTech.DbConnStringCrypto --version 1.0.0
#r "nuget: AgileTech.DbConnStringCrypto, 1.0.0"
#:package AgileTech.DbConnStringCrypto@1.0.0
#addin nuget:?package=AgileTech.DbConnStringCrypto&version=1.0.0
#tool nuget:?package=AgileTech.DbConnStringCrypto&version=1.0.0
AgileTech.DbConnStringCrypto
A lightweight .NET utility library for encoding and decoding database connection strings using AES encryption. Designed to keep connection strings out of plaintext in configuration files, with a built-in license key check for authorized use.
Developed and maintained by AgileTech.
Features
- 🔐 AES-based
Encode/Decodemethods for connection strings - 🔑 License key validation gate before use
- ⚡ Simple static API — no dependency injection or setup required
- 🧩 Targets .NET 8
Installation
dotnet add package AgileTech.DbConnStringCrypto
Or via the NuGet Package Manager:
Install-Package AgileTech.DbConnStringCrypto
Getting Started
1. Validate your license key
Every consumer must call ValidateLicense once (e.g., at application startup) before Encode or Decode will work.
using AgileTech.DbConnStringCrypto;
ConnectionStringCipher.ValidateLicense("YOUR-LICENSE-KEY");
If the key is missing or invalid, this throws UnauthorizedAccessException.
2. Encode a connection string
string plain = "Server=myServer;Database=myDb;User Id=myUser;Password=myPass;";
string encoded = ConnectionStringCipher.Encode(plain);
Console.WriteLine(encoded);
// e.g. "U2FsdGVkX1+abc123..."
Store encoded in your appsettings.json, environment variables, or wherever your config lives — instead of the raw connection string.
3. Decode it back at runtime
string encoded = Configuration["ConnectionStrings:Default"];
string plain = ConnectionStringCipher.Decode(encoded);
using var connection = new SqlConnection(plain);
Full Example
using AgileTech.DbConnStringCrypto;
class Program
{
static void Main()
{
// Step 1: Validate license (required)
ConnectionStringCipher.ValidateLicense("YOUR-LICENSE-KEY");
// Step 2: Encode
string original = "Server=localhost;Database=AppDb;User Id=sa;Password=P@ssw0rd;";
string encoded = ConnectionStringCipher.Encode(original);
Console.WriteLine($"Encoded: {encoded}");
// Step 3: Decode
string decoded = ConnectionStringCipher.Decode(encoded);
Console.WriteLine($"Decoded: {decoded}");
}
}
API Reference
| Method | Description |
|---|---|
ConnectionStringCipher.ValidateLicense(string licenseKey) |
Validates the license key. Must be called before Encode/Decode. Throws UnauthorizedAccessException if invalid. |
ConnectionStringCipher.Encode(string plainConnectionString) |
Encrypts and returns a Base64-encoded connection string. Throws InvalidOperationException if not licensed. |
ConnectionStringCipher.Decode(string encodedConnectionString) |
Decrypts a previously encoded connection string back to plaintext. Throws InvalidOperationException if not licensed. |
Notes & Limitations
- This library uses a static encryption key internal to the package, meaning encoded values are only "obfuscated," not protected by a secret unique to your deployment. It is intended to prevent connection strings from sitting in plaintext in config files — not to replace a secrets manager (e.g., Azure Key Vault, AWS Secrets Manager) for high-security scenarios.
- License validation is a client-side check. It prevents accidental/unauthorized use in good-faith scenarios but is not a substitute for server-side license enforcement in adversarial contexts.
Licensing
This package is proprietary to AgileTech and requires a valid license key to use. Contact licensing@agiletech.com to obtain a key.
Support
For issues, questions, or feature requests, contact the AgileTech development team at support@agiletech.com or open an issue in the project repository.
Changelog
1.0.0
- Initial release
Encode/Decodemethods using AES encryption- Static license key validation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release: AES-based Encode/Decode methods for connection strings with static license key validation.