UniversalSecureEncriptor 1.0.1

There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package UniversalSecureEncriptor --version 1.0.1
                    
NuGet\Install-Package UniversalSecureEncriptor -Version 1.0.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="UniversalSecureEncriptor" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UniversalSecureEncriptor" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="UniversalSecureEncriptor" />
                    
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 UniversalSecureEncriptor --version 1.0.1
                    
#r "nuget: UniversalSecureEncriptor, 1.0.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 UniversalSecureEncriptor@1.0.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=UniversalSecureEncriptor&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=UniversalSecureEncriptor&version=1.0.1
                    
Install as a Cake Tool

UniversalSecureEncriptor

UniversalSecureEncriptor is a robust C# library for secure encryption and decryption of files and text using modern cryptographic standards. It is designed to be easy to use, highly secure, and suitable for a wide range of applications.

Project Information

  • Project Name: UniversalSecureEncriptor
  • Author: Ifeanyi Nwodo
  • License: Apache-2.0

Features

  • AES-GCM Encryption: Uses AES-GCM for authenticated encryption, ensuring both confidentiality and integrity.
  • Password-Based Key Derivation: Keys are derived securely from user passwords using PBKDF2 (SHA-256).
  • File & Text Support: Encrypt and decrypt both files and text strings.
  • Base64 & Binary Output: Supports output as Base64 strings or raw bytes.
  • Hashing Utility: Compute SHA-256 hashes for data integrity checks.
  • Simple API: High-level static methods for easy integration.

How It Works

Encryption Process

  1. Key Derivation: A cryptographic key is derived from the password and a random salt using PBKDF2.
  2. AES-GCM Encryption: Data is encrypted using AES-GCM with a random nonce and authentication tag.
  3. Output Format: The salt, nonce, tag, and ciphertext are combined and returned as either a Base64 string or byte array.

Decryption Process

  1. Extract Parameters: Salt, nonce, tag, and ciphertext are extracted from the encrypted data.
  2. Key Derivation: The key is re-derived from the password and salt.
  3. AES-GCM Decryption: Data is decrypted and integrity is verified using the authentication tag.

API Overview

Main Class: SecureEncryptor

Text Encryption
string encrypted = SecureEncryptor.EncryptText("Hello World", "password123");
string decrypted = SecureEncryptor.DecryptText(encrypted, "password123");
File Encryption
string base64 = SecureEncryptor.EncryptFileToBase64("input.txt", "password123");
byte[] bytes = SecureEncryptor.EncryptFileToBytes("input.txt", "password123");
File Decryption
SecureEncryptor.DecryptFromBase64ToFile(base64, "output.txt", "password123");
byte[] decryptedBytes = SecureEncryptor.DecryptFromBytes(bytes, "password123");
Utility Methods
  • EncryptToBase64ToFile(inputFile, password)
  • EncryptToBytesToFile(inputFile, password)
  • DecryptFromBase64FileToFile(inputFile, outputFile, password)
  • DecryptFromBytesFileToFile(inputFile, outputFile, password)
Hashing
string hash = HashUtility.ComputeSHA256(dataBytes);

Security Details

  • AES-GCM: Provides authenticated encryption, protecting against tampering.
  • PBKDF2 (SHA-256): Secure key derivation with configurable iterations (default: 100,000).
  • Random Salt & Nonce: Ensures unique encryption for each operation.
  • Authentication Tag: Verifies data integrity during decryption.

Usage Example

// Encrypt a file and save as Base64
SecureEncryptor.EncryptToBase64ToFile("myfile.txt", "strongpassword");

// Decrypt from Base64 file to original file
SecureEncryptor.DecryptFromBase64FileToFile("myfile_encrypted.txt", "myfile_decrypted.txt", "strongpassword");

// Encrypt and decrypt text
string encrypted = SecureEncryptor.EncryptText("Secret Message", "strongpassword");
string decrypted = SecureEncryptor.DecryptText(encrypted, "strongpassword");

Folder Structure

UniversalSecureEncriptor/
│
├── Helper/
│   ├── Services/
│   │   ├── FileEncryptor.cs
│   │   ├── KeyManager.cs
│   │   └── TextEncryptor.cs
│   └── Utilities/
│       └── HashUtility.cs
├── SecureEncryptor.cs
├── LICENSE
├── README.md
└── ...

Installation

Add the source files to your C# project or compile as a library. No external dependencies are required beyond .NET's standard cryptography libraries.


License

This project is licensed under the Apache-2.0 License.


Author

Ifeanyi Nwodo


Contributing

Contributions, issues, and feature requests are welcome! Please open an issue or submit a pull request.


Disclaimer

This library is provided as-is. Always review and test cryptographic code for your specific use case and security requirements.


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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • 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.4 342 9/18/2025