VOOZH about

URL: https://www.nuget.org/packages/Effortless.Net.Core.Encryption/

⇱ NuGet Gallery | Effortless.Net.Core.Encryption 1.3.1




Effortless.Net.Core.Encryption 1.3.1

dotnet add package Effortless.Net.Core.Encryption --version 1.3.1
 
 
NuGet\Install-Package Effortless.Net.Core.Encryption -Version 1.3.1
 
 
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="Effortless.Net.Core.Encryption" Version="1.3.1" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Effortless.Net.Core.Encryption" Version="1.3.1" />
 
Directory.Packages.props
<PackageReference Include="Effortless.Net.Core.Encryption" />
 
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 Effortless.Net.Core.Encryption --version 1.3.1
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Effortless.Net.Core.Encryption, 1.3.1"
 
 
#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 Effortless.Net.Core.Encryption@1.3.1
 
 
#: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=Effortless.Net.Core.Encryption&version=1.3.1
 
Install as a Cake Addin
#tool nuget:?package=Effortless.Net.Core.Encryption&version=1.3.1
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Effortless .Net Encryption Core

Project Description

.Net Core version of https://github.com/sjh37/Effortless-.Net-Encryption

Effortless .Net Core Encryption is a library that is written in C#, .Net Core and provides:

  • Rijndael encryption/decryption.
  • Hashing and Digest creation/validation.
  • Password and salt creation.

Thanks to ###Simon Hughes

Before You Begin

Supported .Net Core Version : 5.0

Supported Operating System : Windows

According to .Net Core source code, only 128 Block Size is supported in Rijndael:

Source 1 : https://stackoverflow.com/questions/52699604/how-to-use-rijndael-algorithm-with-256-long-block-size-in-dotnet-core-2-1

Source 2 : dotnet github : RijndaelImplementation.cs

Nuget

https://www.nuget.org/packages/Effortless.Net.Core.Encryption/

To install Effortless.Net.Core.Encryption, run the following command in the Package Manager Console

PM> dotnet add package Effortless.Net.Core.Encryption

Overview

The project is split into four main areas

  • Strings – Encryption/Decryption/Password and Salt generation
  • Hash – Creation and verification of hashes using MD5, SHA1, SHA256, SHA384, SHA512.
  • Digest – Creation and verification of digests (data + hash). Plus two handy ToString() and CreateFromString() functions which come in handy if you want to store data in a Cookie.
  • Bytes – The core of the library. This uses the Rijndael algorithm and works at the byte[] level for most functions.

Examples

// Creating passwords & salts
string password = Strings.CreatePassword(15, true);
string salt = Strings.CreateSalt(20);

// Encrypting/decrypting strings
byte[] key = Bytes.GenerateKey();
byte[] iv = Bytes.GenerateIV();
string encrypted = Strings.Encrypt("Secret", key, iv);
string decrypted = Strings.Decrypt(encrypted, key, iv);
Assert.AreEqual("Secret", decrypted);

// Hashes
string hash = Hash.Create(HashType.SHA512, "Hello", string.Empty, false);

// Digests
var d1 = Digest.Create(HashType.MD5, "Hello", string.Empty);
string cookieString = d1.ToString();
var d2 = Digest.CreateFromString(cookieString, string.Empty);
Assert.AreEqual(d1.Data, d2.Data);
Assert.AreEqual(d1.Hash, d2.Hash);

// Bytes
byte[] key = Bytes.GenerateKey();
byte[] iv = Bytes.GenerateIV();
var data = new byte[1024];
new RNGCryptoServiceProvider().GetBytes(data); // Random data
byte[] encrypted = Bytes.Encrypt(data, key, iv);
byte[] decrypted = Bytes.Decrypt(encrypted, key, iv);
Assert.AreEqual(data, decrypted);

// Digital Signatures
var hash = Hash.Create(HashType.SHA256, "Hello", string.Empty)
var ds = new DigitalSignature();
ds.AssignNewKey();
var signature = ds.SignData(hash);
var result = ds.VerifySignature(hash, signature);
Assert.IsTrue(result);

// Diffie Hellman
var alice = new DiffieHellman();
var bob = new DiffieHellman();
// Bob uses Alice's public key to encrypt his message.
var secretMessage = bob.Encrypt(alice, "Hello");
// Alice uses Bob's public key and IV to decrypt the secret message.
var decryptedMessage = alice.Decrypt(bob, secretMessage);
Assert.AreEqual("Hello", decryptedMessage);

Links

Github : https://github.com/keerthirajap/Effortless.Net.Core.Encryption/

Github Pages : https://keerthirajap.github.io/Effortless.Net.Core.Encryption/

Nuget : https://www.nuget.org/packages/Effortless.Net.Core.Encryption/

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 is compatible.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Effortless.Net.Core.Encryption:

Package Downloads
Our.Community.Configuration

Store configuration data in the Umbraco database

Our.Community.Configuration.OptionsProvider

IOptions provider for Our.Community.Configuration

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.1 13,947 11/3/2021
1.3.0 2,150 11/3/2021