AgileTech.DbConnStringCrypto 1.0.0

There is a newer version of this package available.
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
                    
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="AgileTech.DbConnStringCrypto" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AgileTech.DbConnStringCrypto" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AgileTech.DbConnStringCrypto" />
                    
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 AgileTech.DbConnStringCrypto --version 1.0.0
                    
#r "nuget: AgileTech.DbConnStringCrypto, 1.0.0"
                    
#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 AgileTech.DbConnStringCrypto@1.0.0
                    
#: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=AgileTech.DbConnStringCrypto&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AgileTech.DbConnStringCrypto&version=1.0.0
                    
Install as a Cake Tool

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 / Decode methods 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 / Decode methods using AES encryption
  • Static license key validation
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last Updated
1.0.2 113 7/15/2026
1.0.1 106 7/15/2026
1.0.0 113 7/15/2026

Initial release: AES-based Encode/Decode methods for connection strings with static license key validation.