Vinay.Security.Encryption
1.0.3
dotnet add package Vinay.Security.Encryption --version 1.0.3
NuGet\Install-Package Vinay.Security.Encryption -Version 1.0.3
<PackageReference Include="Vinay.Security.Encryption" Version="1.0.3" />
<PackageVersion Include="Vinay.Security.Encryption" Version="1.0.3" />
<PackageReference Include="Vinay.Security.Encryption" />
paket add Vinay.Security.Encryption --version 1.0.3
#r "nuget: Vinay.Security.Encryption, 1.0.3"
#:package Vinay.Security.Encryption@1.0.3
#addin nuget:?package=Vinay.Security.Encryption&version=1.0.3
#tool nuget:?package=Vinay.Security.Encryption&version=1.0.3
EncryptionClassLib
EncryptionClassLib is a C# library providing easy-to-use, customizable encryption and decryption methods. It supports both AES and RijndaelManaged algorithms with 128-bit and 256-bit key sizes. The library is designed for seamless integration into .NET 6 projects, enabling secure data handling across your applications.
Features
- AES Encryption/Decryption
- 128-bit and 256-bit key support
- Key generation (random or AES-based)
- Asynchronous result wrappers
- RijndaelManaged Encryption/Decryption
- 128-bit and 256-bit key support
- Simple string-based API
- Custom Key Management
- Set and use your own security key
- Result Data Model
- Consistent input/output encapsulation for easy integration
Getting Started
Prerequisites
- .NET 6 or later
- C# 10.0 or later
Installation
Add the project or compiled DLL to your solution.
Add a reference to EncryptionClassLib in your project.
Usage
1. Set the Security Key
EncryptionAsync.GetKey("YourSecretKey123!");
2. Encrypt/Decrypt with AES (128-bit)
// Encrypt
var result = await EncryptionAsync.EncryptionResult128("SensitiveData", null);
Console.WriteLine(result.Output);
// Decrypt
var decrypted = await EncryptionAsync.DcryptionResult128(result.Output, null);
Console.WriteLine(decrypted.Output);
3. Encrypt/Decrypt with AES (256-bit)
var result = await EncryptionAsync.EncryptionResult256("SensitiveData", null);
var decrypted = await EncryptionAsync.DcryptionResult256(result.Output, null);
4. Encrypt/Decrypt with RijndaelManaged (128/256-bit)
string encrypted128 = EncryptionAsync.Encrypt128("SensitiveData", "YourKey");
string decrypted128 = EncryptionAsync.Decrypt128(encrypted128, "YourKey");
string encrypted256 = EncryptionAsync.Encrypt256("SensitiveData", "YourKey");
string decrypted256 = EncryptionAsync.Decrypt256(encrypted256, "YourKey");
5. Custom Key Management
string randomKey = EncryptionAsync.GenerateRandomString(16); // 16 or 32 chars
string aesKey = EncryptionAsync.GenerateAESKey(128); // 128 or 256
API Reference
EncryptionAsync.GetKey(string securityKey)
EncryptionAsync.GenerateRandomString(int length)
EncryptionAsync.GenerateAESKey(int keySize)
EncryptionAsync.EncryptionResult128(string inputData, string key)
EncryptionAsync.DcryptionResult128(string encryptionData, string key)
EncryptionAsync.EncryptionResult256(string inputData, string key)
EncryptionAsync.DcryptionResult256(string encryptionData, string key)
EncryptionAsync.Encrypt128(string plainText, string key)
EncryptionAsync.Decrypt128(string encryptedText, string key)
EncryptionAsync.Encrypt256(string plainText, string key)
EncryptionAsync.Decrypt256(string encryptedText, string key)
ResultData Model
public class ResultData
{
public string Input { get; set; }
public string Output { get; set; }
public string Key { get; set; }
}
Security Notes
- Always use strong, unique keys for encryption.
- Never hard-code sensitive keys in source code.
- For production, consider secure key storage (e.g., Azure Key Vault, AWS KMS).
License
This project is licensed for personal and commercial use.
See LICENSE for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.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.