SecureLibrary 1.0.0

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

AES-256 Encryption Library

📌 Overview

This library provides AES-256 encryption and decryption functionalities using a password-based key derivation mechanism. It ensures secure data encryption using industry best practices like PBKDF2 key derivation and CBC mode with proper padding.

📂 Data Structure

  • Key Size: 256 bits
  • Salt Size: 128 bits
  • IV Size: 128 bits
  • Iterations: 100,000 (PBKDF2)
  • Cipher Mode: CBC (Cipher Block Chaining)
  • Padding Mode: PKCS7

🚀 Usage

Encryption

string encryptedText = Encryptor.Encrypt("Your Secret Data", "StrongPassword");
Console.WriteLine(encryptedText);

Decryption

string decryptedText = Encryptor.Decrypt(encryptedText, "StrongPassword");
Console.WriteLine(decryptedText);

🔍 How It Works

  1. Key Derivation: The password is processed using PBKDF2 to generate a strong 256-bit key.
  2. Salt Generation: A random salt is generated for each encryption to prevent dictionary attacks.
  3. IV Generation: A new Initialization Vector (IV) is created to ensure different ciphertexts for the same plaintext.
  4. AES Encryption: The plaintext is encrypted using AES-256 in CBC mode with PKCS7 padding.
  5. Storage: The salt, IV, and encrypted data are combined and stored securely.
  6. Decryption Process: The salt and IV are extracted, the key is rederived using PBKDF2, and AES-256 decrypts the ciphertext back to plaintext.

✅ Advantages

  • Strong Security: Uses AES-256, the highest standard in symmetric encryption.
  • Password-Based Key Derivation: PBKDF2 makes brute-force attacks highly difficult.
  • Random Salt & IV: Ensures unique encryption outputs for identical inputs.
  • Integrity Protection: Prevents common vulnerabilities like key reuse.
  • Ease of Use: Simple API for encrypting and decrypting data.

🔒 Best Practices

  • Always use a strong, unique password for encryption.
  • Do not hardcode passwords in your application; use a secure vault.
  • Store the encrypted data securely, preferably in a protected database.
  • Regularly rotate passwords to maintain security.
  • Use HMAC authentication for additional integrity verification if required.
  • Implement secure key management practices to avoid unauthorized access.

📜 License

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

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.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.0 135 12/12/2024