KNM.CryptoHelper 1.3.9

KNM.CryptoHelper

Description

KNM.CryptoHelper is a production-ready C# cryptographic library for enterprise .NET applications. Provides AES-256 encryption with HMAC integrity, JWT authentication, TOTP MFA, device fingerprinting, and OTP generation. Full DI integration with fluent configuration.

Installation

Single NuGet package - Zero dependencies!

Install-Package KNM.CryptoHelper

Bundled: OtpNet, QRCoder, UAParser, System.IdentityModel.Tokens.Jwt ✅

Quick Start

builder.Services.AddKnmCryptoCollection(options =>
{
    options.Crypto.CryptoPassword = "YourSecurePassword!";
    options.DeviceFingerprint.CacheExpiryDays = 30;
    options.Otp.Length = 6;
});

2. Fluent Builder

builder.Services.AddKnmCryptoCollection()
    .WithCrypto(crypto => crypto.Iterations = 200_000)
    .WithOtp(opt => opt.Length = 6)
    .WithDeviceFingerprint(opt => opt.CacheExpiryDays = 7);

Core Features

🔐 AES Encryption + HMAC Integrity

string encrypted = crypto.EncryptText("Secret data");
string decrypted = crypto.DecryptText(encrypted); // Tamper-proof

🪪 Device Fingerprinting + Trusted Devices

await crypto.InjectDeviceContextAsync(context, userId); // Sets MFARequired
var deviceInfo = crypto.GetDeviceInfo(context, userId);
string fp = crypto.GenerateDeviceFingerprint(context);

📱 OTP Generation

var otp = crypto.GenerateOtp(); // OtpResult(Code="592134", ExpiryDate)

🔑 JWT Tokens

string jwt = crypto.GenerateJwtToken(userId, email, claims);
bool isValid = crypto.JwtTokenIsValid(jwt).isValid;

🔐 TOTP MFA (QR + Verify)

string secret = crypto.GenerateMfaSecret();
string qrSvg = crypto.GenerateMfaQrCode("user@company.com", secret);
bool valid = crypto.VerifyMfaCode(secret, "123456");

Technical Stack

Feature Algorithm Key Features
Encryption AES-256-CBC + HMAC-SHA256 Tamper-proof, PBKDF2 key derivation
Fingerprint HMAC-SHA256 Stable IP subnet + browser signals
OTP RandomNumberGenerator Configurable length/expiry
JWT HMAC-SHA256 Refresh tokens supported
MFA TOTP (RFC 6238) QR codes, SHA256/512

Enterprise Features

  • Fluent configuration with validation
  • IMemoryCache integration for trusted devices
  • Swagger compatible middleware
  • .NET 10 + MAUI ready
  • Zero external deps - Everything bundled!

Configuration Example

builder.Services.AddKnmCryptoCollection()
    .WithCrypto(opt => opt.Iterations = 100_000)
    .WithOtp(opt => 
    {
        opt.Length = 5;
        opt.ValidityDurationMinutes = 5;
    })
    .WithDeviceFingerprint(opt => 
    {
        opt.SimilarityThreshold = 0.92;
        opt.CacheExpiryDays = 30;
    });

Production crypto made simple - One package, full security suite! 🚀

Showing the top 20 packages that depend on KNM.CryptoHelper.

Packages Downloads
KNM.LicenseValidator
Hybrid offline/online license validation library for .NET 10 with multilanguage support (IT/EN). Features RSA, AES, and HMAC security with database storage and API integration.
0
KNM.LicenseValidator
Hybrid offline/online license validation library for .NET 9 with multilanguage support (IT/EN). Features RSA, AES, and HMAC security with database storage and API integration.
0
KNM.LicenseValidator
Hybrid offline/online license validation library for .NET 9 with multilanguage support (IT/EN). Features RSA, AES, and HMAC security with database storage and API integration.
1
KNM.LicenseValidator
Hybrid offline/online license validation library for .NET 9 with multilanguage support (IT/EN). Features RSA, AES, and HMAC security with database storage and API integration.
2

Version Downloads Last updated
1.4.1 3 20/01/2026
1.4.0 1 20/01/2026
1.3.9 4 09/01/2026
1.3.8 1 08/01/2026
1.3.7 1 08/01/2026
1.3.6 1 08/01/2026
1.3.5 1 08/01/2026
1.2.9 2 08/01/2026
1.2.8 1 08/01/2026
1.2.7 1 08/01/2026
1.2.6 1 08/01/2026
1.2.5 4 08/01/2026
1.1.9 1 02/12/2025
1.1.8 1 02/12/2025
1.1.7 1 01/12/2025
1.1.6 1 01/12/2025
1.1.5 1 01/12/2025
1.0.9 1 01/12/2025
1.0.8 1 01/12/2025
1.0.7 2 03/11/2025
1.0.6 0 03/11/2025
1.0.5 1 03/11/2025