Utilities.AesEncryptor
8.0.945
dotnet add package Utilities.AesEncryptor --version 8.0.945
NuGet\Install-Package Utilities.AesEncryptor -Version 8.0.945
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="Utilities.AesEncryptor" Version="8.0.945" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Utilities.AesEncryptor --version 8.0.945
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Utilities.AesEncryptor, 8.0.945"
#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 Utilities.AesEncryptor as a Cake Addin #addin nuget:?package=Utilities.AesEncryptor&version=8.0.945 // Install Utilities.AesEncryptor as a Cake Tool #tool nuget:?package=Utilities.AesEncryptor&version=8.0.945
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Utilities.AesEncryptor
Installation
dotnet add package Utilities.AesEncryptor
Using service
Register services
using Utilities.AesEncryptor.Interfaces;
using Utilities.AesEncryptor.Services;
ConfigureServices(IServiceCollection services)
{
// this injects as SINGLETON
services.AddSingleton<IAesService, AesService>();
}
Using service
By default, AES-256
encryption/decryption will be used. You can specify the Key
and IV
(Initialization Vector) for encryption.
IV is optional, if you don't provide it, the service will generate a random IV.
With AES-256, the key size is 256 bits (32 bytes) and the IV size is 128 bits (16 bytes).
using Utilities.AesEncryptor.Interfaces;
public class MyProcess
{
private readonly IAesService _aesService;
public MyProcess(IAesService aesService) =>
_aesService = aesService;
public string EncryptSomething() =>
_aesService.Encrypt("PlainText", "Key", "IV");
public string DecryptSomething() =>
_aesService.Decrypt("CipherText", "Key", "IV");
}
AES-256-GCM
You can use AES-256-GCM
encryption/decryption by specifying the EncryptorType
parameter.
Nonce
(IV) and Tag
is generated automatically, provided Nonce(IV) will be ignored.
public string GcmEncryptSomething() =>
_aesService.Encrypt("PlainText", "Key", encryptorType: EncryptorType.AesGcm);
public string GcmDecryptSomething() =>
_aesService.Decrypt("CipherText", "Key", encryptorType: EncryptorType.AesGcm);
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
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 |
---|---|---|
8.0.945 | 105 | 8/8/2024 |