feat(eidas): Implement eIDAS Crypto Plugin with dependency injection and signing capabilities
- Added ServiceCollectionExtensions for eIDAS crypto providers. - Implemented EidasCryptoProvider for handling eIDAS-compliant signatures. - Created LocalEidasProvider for local signing using PKCS#12 keystores. - Defined SignatureLevel and SignatureFormat enums for eIDAS compliance. - Developed TrustServiceProviderClient for remote signing via TSP. - Added configuration support for eIDAS options in the project file. - Implemented unit tests for SM2 compliance and crypto operations. - Introduced dependency injection extensions for SM software and remote plugins.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
// Sprint: SPRINT_4100_0006_0003 - SM Crypto CLI Integration
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StellaOps.Cryptography;
|
||||
|
||||
namespace StellaOps.Cryptography.Plugin.SimRemote.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Dependency injection extensions for SM simulator crypto plugin.
|
||||
/// </summary>
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Add SM simulator crypto provider to the service collection.
|
||||
/// Note: Requires Microsoft.Extensions.Http package and AddHttpClient<SimRemoteClient>() registration.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddSimRemoteCryptoProvider(
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
// Bind SM simulator configuration
|
||||
services.Configure<SimRemoteProviderOptions>(configuration.GetSection("StellaOps:Crypto:Profiles:sm-simulator"));
|
||||
|
||||
// Register crypto provider
|
||||
services.AddSingleton<ICryptoProvider, SimRemoteProvider>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add SM simulator crypto provider with explicit options.
|
||||
/// Note: Requires Microsoft.Extensions.Http package and AddHttpClient<SimRemoteClient>() registration.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddSimRemoteCryptoProvider(
|
||||
this IServiceCollection services,
|
||||
Action<SimRemoteProviderOptions> configureOptions)
|
||||
{
|
||||
services.Configure(configureOptions);
|
||||
services.AddSingleton<ICryptoProvider, SimRemoteProvider>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user