LaraCryptSharp 1.0.0
dotnet add package LaraCryptSharp --version 1.0.0
NuGet\Install-Package LaraCryptSharp -Version 1.0.0
<PackageReference Include="LaraCryptSharp" Version="1.0.0" />
<PackageVersion Include="LaraCryptSharp" Version="1.0.0" />
<PackageReference Include="LaraCryptSharp" />
paket add LaraCryptSharp --version 1.0.0
#r "nuget: LaraCryptSharp, 1.0.0"
#:package LaraCryptSharp@1.0.0
#addin nuget:?package=LaraCryptSharp&version=1.0.0
#tool nuget:?package=LaraCryptSharp&version=1.0.0
LaraCryptSharp
LaraCryptSharp is a .NET library designed to facilitate seamless encryption and decryption of strings compatible with Laravel's encryption mechanisms. It aims to provide an easy-to-use interface for .NET applications that need to interact with data encrypted by Laravel applications, or vice versa.
Features
- Encrypt: Encrypt plain text using AES-256-CBC algorithm, generating a payload that includes the IV (Initialization Vector) and the encrypted data.
- Decrypt: Decrypt payloads encrypted by Laravel (assuming no MAC check is required), allowing for seamless data exchange between Laravel and .NET applications.
Getting Started
To use LaraCryptSharp in your project, include the LaraCryptSharp namespace and utilize the Cipher class for encryption and decryption tasks.
Installation
LaraCryptSharp is available for download as a package from NuGet, allowing for easy integration into your projects. Alternatively, you can clone the repository or directly copy the code into your project if needed.
Usage
Encrypting a String
using LaraCryptSharp;
string plainText = "Hello, world!";
string key = "YourBase64EncodedLaravelAppKey"; // Laravel app key without 'base64:' prefix
string encryptedPayload = Cipher.Encrypt(plainText, key);
Console.WriteLine($"Encrypted Payload: {encryptedPayload}");
Decrypting a String
using LaraCryptSharp;
string encryptedPayload = "YourEncryptedPayloadHere";
string key = "YourBase64EncodedLaravelAppKey"; // Laravel app key without 'base64:' prefix
string decryptedText = Cipher.Decrypt(encryptedPayload, key);
Console.WriteLine($"Decrypted Text: {decryptedText}");
Notes
- The encryption function generates a new IV for each encryption operation and constructs a payload similar to Laravel's, including the IV and the encrypted data.
- The decryption function is designed to work with payloads encrypted by Laravel, assuming no MAC (Message Authentication Code) verification is required.
- Ensure the key used for encryption and decryption matches the Laravel application key used to encrypt the data.
Contributing
Contributions are welcome! If you have suggestions or improvements, feel free to fork the repository and submit a pull request.
License
LaraCryptSharp is open-source software 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. 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. |
-
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.0 | 445 | 4/11/2024 |