using System.ComponentModel.DataAnnotations; using System.Security.Cryptography.X509Certificates; using StellaOps.Cryptography; namespace StellaOps.Cryptography.Plugin.CryptoPro; public sealed class CryptoProGostKeyOptions { [Required] public string KeyId { get; set; } = string.Empty; public string Algorithm { get; set; } = SignatureAlgorithms.GostR3410_2012_256; /// /// Wire format emitted by the signer. Defaults to DER (ASN.1 sequence). Set to Raw for (s || r). /// public GostSignatureFormat SignatureFormat { get; set; } = GostSignatureFormat.Der; /// /// Optional CryptoPro provider name (defaults to standard CSP). /// public string ProviderName { get; set; } = "Crypto-Pro GOST R 34.10-2012 Cryptographic Service Provider"; /// /// Optional container name. If omitted, the certificate private key association is used. /// public string? ContainerName { get; set; } /// /// Set to true when the container lives in the machine key store. /// public bool UseMachineKeyStore { get; set; } /// /// Thumbprint of the certificate that owns the CryptoPro private key. /// public string? CertificateThumbprint { get; set; } /// /// Alternative lookup if thumbprint is not supplied. /// public string? SubjectName { get; set; } public StoreLocation CertificateStoreLocation { get; set; } = StoreLocation.CurrentUser; public StoreName CertificateStoreName { get; set; } = StoreName.My; public CryptoProGostKeyOptions Clone() => new() { KeyId = KeyId, Algorithm = Algorithm, ProviderName = ProviderName, ContainerName = ContainerName, CertificateThumbprint = CertificateThumbprint, SubjectName = SubjectName, CertificateStoreLocation = CertificateStoreLocation, CertificateStoreName = CertificateStoreName, UseMachineKeyStore = UseMachineKeyStore, SignatureFormat = SignatureFormat }; }