feat(infrastructure): add PKCS#11 PDF signing infrastructure

This commit is contained in:
2026-10-22 02:26:13 +02:00
parent 3b4134e873
commit d9cd0d60e3
25 changed files with 2560 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
using DocumentOperator.Application.Common.Configurations;
using DocumentOperator.Application.Common.Interfaces.Services;
using DocumentService.Infrastructure.Crypt.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Options;
namespace DocumentService.Infrastructure.Crypt.DependencyInjection;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddCryptInfrastructure(this IServiceCollection services, IConfiguration configuration)
{
services
.AddOptions<Pkcs11Options>()
.Bind(configuration.GetSection(Pkcs11Options.SectionName))
.ValidateDataAnnotations()
.ValidateOnStart();
services.AddSingleton<IPdfDigitalSignatureService, PdfDigitalSignatureService>();
services.AddSingleton<Pkcs11SelfTestStatusStore>();
services.AddSingleton<IPkcs11SelfTestStatusProvider>(sp => sp.GetRequiredService<Pkcs11SelfTestStatusStore>());
services.AddHostedService<Pkcs11StartupSelfTestHostedService>();
return services;
}
}