pwCryptoLibrary 1.0.0

dotnet add package pwCryptoLibrary --version 1.0.0
NuGet\Install-Package pwCryptoLibrary -Version 1.0.0
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="pwCryptoLibrary" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add pwCryptoLibrary --version 1.0.0
#r "nuget: pwCryptoLibrary, 1.0.0"
#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.
// Install pwCryptoLibrary as a Cake Addin
#addin nuget:?package=pwCryptoLibrary&version=1.0.0

// Install pwCryptoLibrary as a Cake Tool
#tool nuget:?package=pwCryptoLibrary&version=1.0.0

pwCryptoLibrary

A C# library to encrypt and decrypt data with AES, RSA, TripleDES algorithms.

How to use

string textToEncrypt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.";
string passPhrase = "your passphrase";
string cryptedText;
string decryptedText;
string RSAPublicKey = "";
string RSAPrivateKey = "";

Console.WriteLine("AES");
Console.WriteLine("---");
cryptedText = CryptoService.Encrypt(CryptoService.CryptoServiceEnum.AES, passPhrase, textToEncrypt);
Console.WriteLine(cryptedText);
decryptedText = CryptoService.Decrypt(CryptoService.CryptoServiceEnum.AES, passPhrase, cryptedText);
Console.WriteLine(decryptedText);

Console.WriteLine();

Console.WriteLine("RSA");
Console.WriteLine("---");
CryptoService.RSAGenerateKeys(2048, ref RSAPublicKey, ref RSAPrivateKey);
cryptedText = CryptoService.Encrypt(CryptoService.CryptoServiceEnum.RSA, "", textToEncrypt, RSAPublicKey);
Console.WriteLine(cryptedText);
decryptedText = CryptoService.Decrypt(CryptoService.CryptoServiceEnum.RSA, "", cryptedText, RSAPrivateKey);
Console.WriteLine(decryptedText);

Result :

Text to crypt
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.

AES

cryptedText
SfyZE82C7r4L1XI8DCrWsLBIBFScnTaFAPBucD9y60VemXiXwBQA4tKAGQiYDzCL3f6tbhWx5UdHThuNebyTNVCX0fjg0+CXKRAlWMO2vsNRj7ghA9SoArqZTBiZcq47

decryptedText
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.

RSA

cryptedText
sY/nb/4YXi006ieVu8CgW1JIsF2GQp/ZoKXwlg1Qqlnd7rvSNHZ8Che/NWXsGGPMtFmgH3Ma0HJizNX1kojPe1KMCyknUhGHvy7relFO128I71l1mTcko60eHWo5XI/2U6YBsj7TlR7WE1ytzQu4JBPRpQa15ukbso/+m7qBvR2rwKkWYZ8zY6pCYfw3nhpFeVLyPlFIT3IymlcUHOfr/RJT4ye0YT26BSxf2bpTTlr0P8M+cLX6mWkQs8au3/p3wGY3ploYgaioH+PmqJtzDlXVUqlcQEPH5a+FuouMqJ4iLObmC9QV9s7o7Nv48amkEALAG+7OxGGPqrSVHljgDw==

decryptedText
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus.

Important note

For RSA, the passphrase is not needed.
You must generate public and private key before using the method

CryptoService.RSAGenerateKeys

Then, you must send public key to encrypt and private key to decrypt.

Product Compatible and additional computed target framework versions.
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6

    • 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.

Version Downloads Last updated
1.0.0 181 3/24/2023

- 1.0.0 First version 24/03/2023