using EnvelopeGenerator.Application.Common.Enums; using System.ComponentModel.DataAnnotations; namespace EnvelopeGenerator.Application.Common.Configurations; /// /// Represents PKCS#11 signing configuration for PDF signing workflows. /// This options model maps to the Crypt:Pkcs11 configuration section. /// public sealed class Pkcs11Options { /// /// Configuration section path used for binding PKCS#11 options. /// public const string SectionName = "Crypt:Pkcs11"; /// /// Absolute or resolvable file path of the PKCS#11 provider library. /// [Required] [MinLength(1)] public required string LibraryPath { get; set; } /// /// Optional numeric slot identifier used to directly select the target token slot. /// public ulong? SlotId { get; set; } /// /// Optional token label used as a fallback token selector when is not provided. /// public string? TokenLabel { get; set; } /// /// Optional PKCS#11 proxy endpoint (for example tcp://host:port). /// public string? ProxySocket { get; set; } /// /// Optional full path to pkcs11-tool, used by diagnostics and fallback paths. /// public string? ToolPath { get; set; } /// /// User PIN used to authenticate to the PKCS#11 token session. /// [Required] [MinLength(1)] public required string UserPin { get; set; } /// /// Label of the private key object used to create digital signatures. /// [Required] [MinLength(1)] public required string PrivateKeyLabel { get; set; } /// /// Label of the certificate object returned/embedded with the signature. /// [Required] [MinLength(1)] public required string CertificateLabel { get; set; } /// /// Optional global default signing reason used when request-level options do not specify a value. /// public string? DefaultReason { get; set; } /// /// Optional global default application name used when request-level options do not specify a value. /// public string? DefaultApplicationName { get; set; } /// /// Controls how fallback signing time is created when request-level options do not specify a value. /// true uses , false uses . /// public bool UseUtcSigningTime { get; set; } = true; /// /// Optional global default certification level used when request-level options do not specify a value. /// public PdfSignatureCertificationLevel? DefaultCertificationLevel { get; set; } }