SecurityHelperLibrary 2.1.2

dotnet add package SecurityHelperLibrary --version 2.1.2
                    
NuGet\Install-Package SecurityHelperLibrary -Version 2.1.2
                    
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="SecurityHelperLibrary" Version="2.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SecurityHelperLibrary" Version="2.1.2" />
                    
Directory.Packages.props
<PackageReference Include="SecurityHelperLibrary" />
                    
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 SecurityHelperLibrary --version 2.1.2
                    
#r "nuget: SecurityHelperLibrary, 2.1.2"
                    
#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 SecurityHelperLibrary@2.1.2
                    
#: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=SecurityHelperLibrary&version=2.1.2
                    
Install as a Cake Addin
#tool nuget:?package=SecurityHelperLibrary&version=2.1.2
                    
Install as a Cake Tool

SecurityHelperLibrary v2.1.2

SecurityHelperLibrary is a production-grade cryptographic helper library for password hashing, message authentication, and authenticated encryption.

Targets:

  • net481
  • net8.0

Highlights

  • PBKDF2 with strong defaults and formatted storage payload support.
  • Argon2id support with security guardrails (minimums + bounded parallelism).
  • AES-GCM encrypt/decrypt APIs on modern targets.
  • Fixed-time hash verification behavior to reduce timing leakage.
  • Sensitive-buffer cleanup helpers for byte[] and Span<char>.
  • Generic external cryptographic error model with optional internal incident-code logging.

Install

dotnet add package SecurityHelperLibrary --version 2.1.2

Quick Start

PBKDF2 hash + verify

using SecurityHelperLibrary;
using System.Security.Cryptography;

ISecurityHelper helper = new SecurityHelper();

string stored = helper.HashPasswordWithPBKDF2(
    "MyPassword123!",
    out string salt,
    HashAlgorithmName.SHA256,
    iterations: 210000,
    hashLength: 32);

bool valid = helper.VerifyPasswordWithPBKDF2("MyPassword123!", stored);

Argon2id hash

using SecurityHelperLibrary;

ISecurityHelper helper = new SecurityHelper();

string salt = helper.GenerateSalt();
string argon2Hash = helper.HashPasswordWithArgon2(
    "MyPassword123!",
    salt,
    iterations: 4,
    memoryKb: 131072,
    degreeOfParallelism: 4,
    hashLength: 32);

AES-GCM (supported target)

using SecurityHelperLibrary;

ISecurityHelper helper = new SecurityHelper();

byte[] key = helper.GenerateSymmetricKey(32);
string encrypted = helper.EncryptStringGCM("sensitive-value", key);
string decrypted = helper.DecryptStringGCM(encrypted, key);

helper.ClearSensitiveData(key);

Optional incident telemetry

You can provide an internal incident callback while keeping external error messages generic:

using SecurityHelperLibrary;

var helper = new SecurityHelper(code =>
{
    // Send to logs/SIEM/internal monitoring
    Console.WriteLine($"Security incident: {code}");
});

Security notes

  • Use per-user random salt values.
  • Keep Argon2/PBKDF2 cost settings high enough for your threat model.
  • Store secrets and JWT signing keys in secure configuration providers.
  • Clear sensitive buffers when possible.

License

See LICENSE.txt.

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. 
.NET Framework net481 is compatible. 
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
2.1.2 57 3/3/2026
2.1.1 71 3/1/2026
2.1.0 72 3/1/2026
2.0.3 73 3/1/2026
2.0.0 99 2/1/2026
1.0.0 173 8/15/2025