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,43 @@
|
||||
// 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.SmSoft.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Dependency injection extensions for SM software crypto plugin.
|
||||
/// </summary>
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Add SM software crypto provider to the service collection.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddSmSoftCryptoProvider(
|
||||
this IServiceCollection services,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
// Bind SM soft configuration
|
||||
services.Configure<SmSoftProviderOptions>(configuration.GetSection("StellaOps:Crypto:Profiles:sm-soft"));
|
||||
|
||||
// Register crypto provider
|
||||
services.AddSingleton<ICryptoProvider, SmSoftCryptoProvider>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add SM software crypto provider with explicit options.
|
||||
/// </summary>
|
||||
public static IServiceCollection AddSmSoftCryptoProvider(
|
||||
this IServiceCollection services,
|
||||
Action<SmSoftProviderOptions> configureOptions)
|
||||
{
|
||||
services.Configure(configureOptions);
|
||||
services.AddSingleton<ICryptoProvider, SmSoftCryptoProvider>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user