KNM.CryptoHelper 1.4.1
KNM.CryptoHelper
Description
KNM.CryptoHelper is a comprehensive C# cryptographic library providing AES encryption with HMAC integrity, API key generation, JWT token handling, and TOTP MFA support. Designed for enterprise .NET applications with full configuration control and dependency injection integration.
Installation
Single NuGet Package - Everything included!
Install-Package KNM.CryptoHelper
No additional dependencies required - OtpNet, QRCoder, and all cryptographic primitives are already bundled.
Quick Start
1. Object Initializer (Your Preferred Style)
services.AddKnmCryptoCollection(options =>
{
options.Crypto.CryptoPassword = "miaPasswordSicura!";
options.Crypto.Iterations = 100_000;
options.Mfa.Algorithm = "SHA256";
});
2. Fluent Configuration
services.AddKnmCryptoCollection()
.WithCrypto(crypto => crypto.Iterations = 200_000)
.WithMfa(mfa => mfa.Digits = 6);
3. Direct Constructor
var options = new Options
{
Crypto = new CryptoOptions { CryptoPassword = "test123" }
};
var cryptoHelper = new CryptoHelper(options);
Core Features
🔐 Text Encryption/Decryption
string encrypted = cryptoHelper.EncryptText("Secret data");
string decrypted = cryptoHelper.DecryptText(encrypted); // Throws on tamper
🔑 API Key Management
string apiKey = cryptoHelper.GenerateApiKey(userGuid, DateTime.UtcNow.AddDays(30));
bool isValid = cryptoHelper.VerifyApiKey(userGuid, expirationDate, apiKey);
🪪 JWT Token Handling
string jwt = cryptoHelper.GenerateJwtToken("user123", "user@domain.com", "username");
var (isValid, expires) = cryptoHelper.JwtTokenIsValid(jwt);
🔐 MFA TOTP (Everything Included!)
// Setup MFA
string encryptedSecret = cryptoHelper.GenerateMfaSecret(); // Save to DB
string qrCodeBase64 = cryptoHelper.GenerateMfaQrCode(userEmail, encryptedSecret);
// Verify login
bool valid = cryptoHelper.VerifyMfaCode(user.EncryptedMfaSecret, "123456");
Technical Details
| Feature | Algorithm | Format |
|---|---|---|
| Encryption | AES-256-CBC + HMAC-SHA256 | !HMAC:SALT:IV:CIPHERTEXT (Base64) |
| API Keys | HMAC-SHA256 | Base64-encoded |
| JWT | HMAC-SHA256 | Standard JWT |
| MFA | TOTP (RFC 6238) | otpauth://totp QR codes |
All dependencies transitive - OtpNet, QRCoder bundled in KNM.CryptoHelper package!
Dependency Injection (.NET 10)
using KNM.CryptoHelper;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddKnmCryptoCollection(options =>
{
options.Crypto.CryptoPassword = "SecurePassword123!";
});
Zero configuration headaches - One package, one extension method, full crypto 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 |
.NET 10.0
- Microsoft.AspNetCore.Http (>= 2.3.9)
- Microsoft.Extensions.Caching.Memory (>= 10.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.1)
- Otp.NET (>= 1.4.1)
- QRCoder (>= 1.7.0)
- System.IdentityModel.Tokens.Jwt (>= 8.15.0)
- UAParser (>= 3.1.47)
| 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 |