SingularFrameworkCore.DataProcessor.SymmetricEncryptor 0.1.0-beta

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

// Install SingularFrameworkCore.DataProcessor.SymmetricEncryptor as a Cake Tool
#tool nuget:?package=SingularFrameworkCore.DataProcessor.SymmetricEncryptor&version=0.1.0-beta&prerelease                

SingularFrameworkCore.DataProcessor.SymmetricEncryptor

A C# library that provides an Encryption layer implementation for the SingularFrameworkCore.DataProcessor.IDataProcessorLayer<byte[]> interface. This library uses System.Security.Cryptography library to offer generic-robust Symmetric Encryption support.

Features

  • Generic Symmetric Encryption: Supports any Symmetric encryptor that uses ICryptoTransform.
  • System.Security.Cryptography: Utilizes the standard System.Security.Cryptography library for symmetric encryption operations.

Installation

The package is available on NuGet. To install it, use the following command:

Install-Package SingularFrameworkCore.DataProcessor.SymmetricEncryptor

Or using the .NET CLI:

dotnet add package SingularFrameworkCore.DataProcessor.SymmetricEncryptor

Usage

NOTE: Both Encryption and Decryption processes must have same Key and IV for the same Object

using System.Security.Cryptography;
using SingularFrameworkCore;
using SingularFrameworkCore.DataProcessor.SymmetricEncryptor;

Aes aes = Aes.Create();

Singular<T, byte[]> secret = new Singular<T, byte[]>(
            repository,
            serializer,
            preProcessors,
            new List<IDataProcessorLayer<byte[]>>()
            {
                new SymmetricEncryptor(
                    () =>
                    {
                        aes.Key = GetEncryptionKey();
                        aes.IV = GetEncryptionIV(); 
                        return aes.CreateEncryptor();
                    },
                    decryptorFactory: () =>
                    {
                        aes.Key = GetEncryptionKey();
                        aes.IV = GetEncryptionIV(); 
                        return aes.CreateDecryptor();
                    }
                ),
            }
        );

Requirements

  • .NET Standard 8.0+
  • System.Security.Cryptography

Contributing

Contributions are welcome! Please feel free to submit a Pull Request to the development branch.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Author

Created by Mohammad Ayaad

Product 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.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.0-beta 49 2/21/2025