Files
git.stella-ops.org/src/__Libraries/StellaOps.Cryptography.Plugin.CryptoPro/CryptoProGostKeyOptions.cs
master cef4cb2c5a Add support for ГОСТ Р 34.10 digital signatures
- Implemented the GostKeyValue class for handling public key parameters in ГОСТ Р 34.10 digital signatures.
- Created the GostSignedXml class to manage XML signatures using ГОСТ 34.10, including methods for computing and checking signatures.
- Developed the GostSignedXmlImpl class to encapsulate the signature computation logic and public key retrieval.
- Added specific key value classes for ГОСТ Р 34.10-2001, ГОСТ Р 34.10-2012/256, and ГОСТ Р 34.10-2012/512 to support different signature algorithms.
- Ensured compatibility with existing XML signature standards while integrating ГОСТ cryptography.
2025-11-09 21:59:57 +02:00

63 lines
2.1 KiB
C#

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;
/// <summary>
/// Wire format emitted by the signer. Defaults to DER (ASN.1 sequence). Set to Raw for (s || r).
/// </summary>
public GostSignatureFormat SignatureFormat { get; set; } = GostSignatureFormat.Der;
/// <summary>
/// Optional CryptoPro provider name (defaults to standard CSP).
/// </summary>
public string ProviderName { get; set; } = "Crypto-Pro GOST R 34.10-2012 Cryptographic Service Provider";
/// <summary>
/// Optional container name. If omitted, the certificate private key association is used.
/// </summary>
public string? ContainerName { get; set; }
/// <summary>
/// Set to true when the container lives in the machine key store.
/// </summary>
public bool UseMachineKeyStore { get; set; }
/// <summary>
/// Thumbprint of the certificate that owns the CryptoPro private key.
/// </summary>
public string? CertificateThumbprint { get; set; }
/// <summary>
/// Alternative lookup if thumbprint is not supplied.
/// </summary>
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
};
}