FlowEncrypt 1.0.1
See the version list below for details.
dotnet add package FlowEncrypt --version 1.0.1
NuGet\Install-Package FlowEncrypt -Version 1.0.1
<PackageReference Include="FlowEncrypt" Version="1.0.1" />
paket add FlowEncrypt --version 1.0.1
#r "nuget: FlowEncrypt, 1.0.1"
// Install FlowEncrypt as a Cake Addin #addin nuget:?package=FlowEncrypt&version=1.0.1 // Install FlowEncrypt as a Cake Tool #tool nuget:?package=FlowEncrypt&version=1.0.1
FlowEncrypt
Description
FlowEncrypt is a C# library providing robust encryption and decryption functionalities for files and in-memory data. Utilizing AES encryption with support for asymmetric key encryption of the salt, this library ensures secure handling of sensitive data.
Features
- Encrypt and decrypt data streams, files and byte arrays (IEnumerable).
- Support for RSA public/private key pair for salt encryption in AES.
- Simple and intuitive API.
- Secure and efficient implementation.
Getting Started
Prerequisites
- .NET 8.0 or later.
Installation
Clone the repository to your local machine:
git clone https://github.com/forReason/FlowEncrypt.git
Usage
File Encryption and Decryption
string inputFile = "path/to/input.txt";
string encryptedFile = "path/to/encrypted.txt";
string decryptedFile = "path/to/decrypted.txt";
string password = "yourStrongPassword";
// Encrypting a file
EncryptFiles.Encrypt(inputFile, eoutputFile, password);
// Decrypting a file
EncryptFiles.Decrypt(inputFile, outputFile, password);
In-Memory Data Encryption and Decryption
string originalText = "Hello, World!";
IEnumerable<byte> data = Encoding.UTF8.GetBytes(originalText);
// Encrypting data
IEnumerable<byte> encryptedData = EncryptData.Encrypt(data, password);
// Decrypting data
IEnumerable<byte> decryptedData = EncryptData.Decrypt(encryptedData, password);
Usage with streams
Basic Encryption
using MemoryStream outputStream = new MemoryStream(dataToEncrypt);
using (EncryptingStream encryptStream = new (outputStream, password, publicKey: null))
{
encryptStream.Write(originalData, 0, originalData.Length);
}
Basic Decryption
using MemoryStream inputStream = new MemoryStream(encryptedData);
using DecryptingStream decryptStream = new DecryptingStream(inputStream, password);
using StreamReader reader = new StreamReader(decryptStream);
string decryptedText = reader.ReadToEnd();
Encryption with Public Key
If the data was encrypted using a public key:
(X509Certificate2 PublicKey, X509Certificate2 PrivateKey) keys = HelperFunctions.GenerateKeys();
using MemoryStream outputStream = new ();
using (EncryptingStream encryptStream = new (outputStream, password, keys.PublicKey))
{
encryptStream.Write(originalData, 0, originalData.Length);
}
Decryption with Private Key
If the data was encrypted using a public key:
(X509Certificate2 PublicKey, X509Certificate2 PrivateKey) keys = HelperFunctions.GenerateKeys();
using MemoryStream inputStream = new MemoryStream(encryptedDataWithPublicKey);
using DecryptingStream decryptStream = new DecryptingStream(inputStream, password, keys.PrivateKey);
using StreamReader reader = new StreamReader(decryptStream);
string decryptedTextWithPrivateKey = reader.ReadToEnd();
Notes
- Ensure that the
EncryptStream
andDecryptStream
are properly disposed of to release all resources. - For encryption with a public key, ensure the corresponding private key is available for decryption.
- These classes are designed to work seamlessly with streams, making them versatile for various data sources.
Contributing
Contributions are welcome! Please read our Contributing Guide for more information.
License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on FlowEncrypt:
Package | Downloads |
---|---|
SimpleBackup
SimpleBlackup is an easy to use, simple and lightweight backup and restore library for creating and restoring file backups. supports plain, compressed and encrypted backups. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Update Readme