Fondness.Cipher 1.0.1

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

Fondness.Cipher

CI NuGet Version NuGet Downloads License

A simple, high-performance string encryption and decryption extension library using AES (Advanced Encryption Standard) cryptography.

πŸš€ Features

  • Simple API: Easy-to-use extension methods for string encryption/decryption
  • AES Encryption: Uses industry-standard AES encryption algorithm
  • Custom Keys: Support for custom encryption keys
  • High Performance: Optimized for speed and efficiency
  • Multi-Framework: Supports .NET 6.0, 7.0, 8.0, and 9.0
  • Secure: Implements proper cryptographic practices

πŸ“¦ Installation

Package Manager Console

PM> install-package Fondness.Cipher

.NET CLI

dotnet add package Fondness.Cipher

πŸ’‘ Usage

Install this package using the NuGet package manager. You don't need any configuration on the application, just call the string extension methods:

string input = "Hello World!";
var encryptedValue = value.ToEncrypt();
var decryptValue = encryptedValue.ToDecrypt();

You can also provide your custom encryption key as follows:

string input = "Hello World!";
string encryptionKey = "abc123";
var encryptedValue = value.ToEncrypt(encryptionKey);
var decryptValue = encryptedValue.ToDecrypt(encryptionKey);

Make sure you provide the same encryption key for both encryption and decryption.

⚠️ Important Notes

  • Key Consistency: Always use the same encryption key for both encryption and decryption
  • Key Security: Store your custom encryption keys securely (environment variables, key vaults, etc.)
  • Key Length: Custom keys should be sufficiently long for security (recommended: 32+ characters)
  • Exception Handling: Handle potential exceptions for invalid inputs or wrong keys

πŸ” Security Considerations

  • Uses AES encryption with PBKDF2 key derivation
  • Generates unique encrypted outputs for the same input (due to IV usage)
  • Invalid decryption attempts with wrong keys will result in garbled output or exceptions
  • Base64 encoding is used for the encrypted output string format

πŸ§ͺ Exception Handling

try
{
    string encrypted = "invalid-base64-string"; 
    string decrypted = encrypted.ToDecrypt();
} 
catch (FormatException) 
{
    // Handle invalid Base64 input 
} 
catch (ArgumentNullException) 
{
    // Handle null input 
}
catch (CryptographicException) 
{
    // Handle decryption failures 
}

🎯 Supported Frameworks

  • .NET 6.0
  • .NET 7.0
  • .NET 8.0
  • .NET 9.0

πŸ“„ License

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

🀝 Contributing

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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“Š Changelog

Version 1.0.0

  • Initial release
  • Basic encryption/decryption functionality
  • Support for custom encryption keys

Version 1.0.1

  • Multi-framework support

πŸ›‘οΈ License

Β©Fondness Open Source. Licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 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 is compatible.  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.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.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.1 1,849 6/27/2025
1.0.0 3,090 5/12/2022