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.SmRemote.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Dependency injection extensions for SM remote crypto plugin.
|
||||
/// </summary>
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Add SM remote crypto provider to the service collection.
|
||||
/// Note: Requires Microsoft.Extensions.Http package and AddHttpClient<SmRemoteHttpClient>() registration.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddSmRemoteCryptoProvider(
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
// Bind SM remote configuration
|
||||
services.Configure<SmRemoteProviderOptions>(configuration.GetSection("StellaOps:Crypto:Profiles:sm-remote"));
|
||||
|
||||
// Register crypto provider
|
||||
services.AddSingleton<ICryptoProvider, SmRemoteHttpProvider>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add SM remote crypto provider with explicit options.
|
||||
/// Note: Requires Microsoft.Extensions.Http package and AddHttpClient<SmRemoteHttpClient>() registration.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddSmRemoteCryptoProvider(
|
||||
this IServiceCollection services,
|
||||
Action<SmRemoteProviderOptions> configureOptions)
|
||||
{
|
||||
services.Configure(configureOptions);
|
||||
services.AddSingleton<ICryptoProvider, SmRemoteHttpProvider>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user