TPJ.Encrypt
3.0.0
See the version list below for details.
dotnet add package TPJ.Encrypt --version 3.0.0
NuGet\Install-Package TPJ.Encrypt -Version 3.0.0
<PackageReference Include="TPJ.Encrypt" Version="3.0.0" />
paket add TPJ.Encrypt --version 3.0.0
#r "nuget: TPJ.Encrypt, 3.0.0"
// Install TPJ.Encrypt as a Cake Addin #addin nuget:?package=TPJ.Encrypt&version=3.0.0 // Install TPJ.Encrypt as a Cake Tool #tool nuget:?package=TPJ.Encrypt&version=3.0.0
TPJ Encrypt library - Easily encrypt values. Simple, light weight, easy to setup!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration (>= 2.0.0)
- Microsoft.Extensions.DependencyInjection (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
V3.0.0+ only supports .netstandard2.0, which works in .net4.6.1 + / .netcore2.0 +. If you are using .net4.5.2 / .net 4.6 you can use TPJ.Encrypt V2.X.X.
ASP.Net Core Website / WebAPI Set up -
Within appsettings.json and add the following
{
"TPJ": {
"Encrypt": {
"EncryptionKey": "",
"Salt": "",
"KeySize": "",
}
}
}
EncryptionKey– (Required) Key used to lock the string down so it can only be decrypted using the same key
Salt - This size of the IV (in bytes) must = (keysize / 8). Default keysize is 256, so the IV must be 32 bytes long. Using a 16 character string gives us 32 bytes when converted to a byte array.
KeySize - by default its set to 256 which means you need a 32byte salt key if set to 128 you need a 16byte salt or 512 you need a 64 byte salt
Example appsettings.json setup –
{
"TPJ": {
"Encrypt": {
"EncryptionKey": "asdzgfh|£%^%TEGDSTEGbg54e523s",
"Salt": "tu89gaji343t89u2",
"KeySize": "256",
}
}
}
Once appsettings.json is done open StartUp.cs file and add the following using -
using TPJ.Encrypt;
then go to ConfigureServices
services.AddTPJEncrypt();
Then using DI within asp.net core you can call IEncrypt like so
private readonly TPJ.Encrypt.IEncryption _encryption;
public HomeController(TPJ.Encrypt.IEncryption encryption)
{
_encryption = encryption;
}
Then you might have this
public string EncryptString(string valueToEncrypt)
{
return _encryption.Encrypt(valueToEncrypt);
}
It really is that simple you will get an encrypted string returned. To then decrypt the string call _encryption.Decrypt(encryptedValue);