MyTrout.Pipelines.Steps.Cryptography
4.1.1
dotnet add package MyTrout.Pipelines.Steps.Cryptography --version 4.1.1
NuGet\Install-Package MyTrout.Pipelines.Steps.Cryptography -Version 4.1.1
<PackageReference Include="MyTrout.Pipelines.Steps.Cryptography" Version="4.1.1" />
<PackageVersion Include="MyTrout.Pipelines.Steps.Cryptography" Version="4.1.1" />
<PackageReference Include="MyTrout.Pipelines.Steps.Cryptography" />
paket add MyTrout.Pipelines.Steps.Cryptography --version 4.1.1
#r "nuget: MyTrout.Pipelines.Steps.Cryptography, 4.1.1"
#:package MyTrout.Pipelines.Steps.Cryptography@4.1.1
#addin nuget:?package=MyTrout.Pipelines.Steps.Cryptography&version=4.1.1
#tool nuget:?package=MyTrout.Pipelines.Steps.Cryptography&version=4.1.1
MyTrout.Pipelines.Steps.Cryptography
Introduction
MyTrout.Pipelines.Steps.Cryptography provides Pipeline steps to encrypt, hash, and decrypt streams.
MyTrout.Pipelines.Steps.Cryptography targets .NET 6.0 and .NET 7.0-preview.3
For more details on Pipelines, see Pipelines.Core
For more details on Pipelines.Hosting, see Pipelines.Hosting
For a list of available steps, see Available Steps
Installing via NuGet
Install-Package MyTrout.Pipelines.Steps.Cryptography
Software dependencies
1. MyTrout.Pipelines 4.0 minimum
All software dependencies listed above use the MIT License.
How do I use DecryptStreamWithAes256Step in this library?
sample C# code
using MyTrout.Pipelines;
using MyTrout.Pipelines.Hosting;
using MyTrout.Pipelines.Steps.Cryptography
using System;
using System.Linq;
using System.Threading.Tasks;
namespace MyTrout.Pipeline.Hosting.Samples
{
public class Program
{
public static async Task Main(string[] args)
{
var host = Host.CreateDefaultBuilder(args)
.AddStepDependency<DecryptStreamWithAes256Options>()
.UsePipeline(builder =>
{
builder
.AddStep<StepThatLoadsStream>()
.AddStep<DecryptStreamWithAes256Step>()
.AddStep<StepThatProcessesTheStream>();
})
.Build();
//
// IMPORTANT NOTE FOR DEVELOPERS:
//
// Use StartAsync() to allow the caller to review the PipelineContext after execution.
//
await host.StartAsync().ConfigureAwait(false);
var context = host.Services.GetService<PipelineContext>();
if(context.Errors.Any())
{
// TODO: Errors have already been logged, do any special error processing here.
}
await host.StopAsync().ConfigureAwait(false);
return 0;
}
}
}
}
sample appsettings.json file
{
"DecryptionInitializationVector": "user supplied initialization vector",
"DecryptionKey: "user supplied decryption key"
}
How do I use Pipelines.Hosting with different configurations for different instances of the same step.
Each decrypt step would use a different configuration to
using MyTrout.Pipelines;
using MyTrout.Pipelines.Hosting;
using MyTrout.Pipelines.Steps.Cryptography
using System;
using System.Linq;
using System.Threading.Tasks;
namespace MyTrout.Pipeline.Hosting.Samples
{
public class Program
{
public static async Task Main(string[] args)
{
// IMPORTANT NOTE FOR DEVELOPERS !
//
// Step Dependencies with context must be defined BEFORE UsePipelines() to load the dependencies correctly.
//
var host = Host.CreateDefaultBuilder(args)
.AddStepDependency<DecryptStreamWithAes256Options>("context-A")
.AddStepDependency<DecryptStreamWithAes256Options>("context-B")
.UsePipeline(builder =>
{
builder
.AddStep<LoadStreamToProcess>()
.AddStep<DecryptStreamWithAes256Step>("context-A")
.AddStep<TakeDataFromFirstStreamAndCreateANewStream>()
.AddStep<DecryptStreamWithAes256Step>("context-B")
.AddStep<ProcessSecondDecryptedStream>()
})
.Build();
// IMPORTANT NOTE FOR DEVELOPERS !
//
// Use StartAsync() to allow the caller to review the PipelineContext after execution.
//
await host.StartAsync().ConfigureAwait(false);
var context = host.Services.GetService<PipelineContext>();
if(context.Errors.Any())
{
// TODO: Errors have already been logged, do any special error processing here.
}
await host.StopAsync().ConfigureAwait(false);
return 0;
}
}
}
}
sample appsettings.json file
{
"context-A": {
"DecryptionInitializationVector": "user supplied initialization vector #1",
"DecryptionKey: "user supplied decryption key #1"
},
"context-B": {
"DecryptionInitializationVector": "user supplied initialization vector #2",
"DecryptionKey: "user supplied decryption key #2"
}
}
How do I provide secrets such as DecryptionInitializationVector and DecryptionKey to the ~Options classes.
All of the ~Options classes now use the Retrieve~ methods for secrets to allow callers to reconfigure how secrets are stored.
- For simple non-secure implementations, a configuration value named the same as the ~Options property can be defined in any IConfigurationProvider and the default Retrieve~ method will be used.
- For a more secure implementation, encrypt the configuration value and override the Retrieve~ method with your implementation for decrypting the value; add your new ~Options class to your DI Injection using the base ~Options class type.
- For a more secure implementation, override the Retrieve~ methods and retrieve your secrets from a location such as Azure Key Vault, Hashicorp Vault, or AWS Secrets Manager; and add your new ~Options class to your DI injection using the base ~Options class type.
- For a more secure implementation, create an factory method used by the DI framework that only loads the secrets values when the ~Options class is needed; add this factory method under the base ~Options class type
DISCLAIMER: ALL SECURITY SUGGESTIONS IN THIS SECTIONS ARE COVERED UNDER THE SAME 'USE AT YOUR OWN RISK' LICENSE AS THE SOFTWARE.
Product | Versions 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 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. |
-
net6.0
- MyTrout.Pipelines (>= 4.0.3 && < 5.0.0)
-
net7.0
- MyTrout.Pipelines (>= 4.0.3 && < 5.0.0)
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 |
---|---|---|
4.1.1 | 409 | 12/6/2022 |
4.1.0 | 396 | 12/6/2022 |
4.0.0 | 529 | 5/15/2022 |
3.2.0 | 525 | 4/3/2022 |
3.1.0 | 376 | 12/26/2021 |
3.0.0 | 461 | 6/30/2021 |
2.0.0 | 463 | 12/30/2020 |
1.0.0 | 536 | 8/11/2020 |
0.5.0-beta | 414 | 7/23/2020 |
0.4.0-beta | 451 | 7/17/2020 |
0.2.2-beta | 383 | 6/28/2020 |