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.
This commit is contained in:
master
2025-11-09 21:59:57 +02:00
parent 75c2bcafce
commit cef4cb2c5a
486 changed files with 32952 additions and 801 deletions

View File

@@ -20,9 +20,12 @@
<ItemGroup>
<ProjectReference Include="../../Authority/StellaOps.Authority/StellaOps.Authority.Plugins.Abstractions/StellaOps.Authority.Plugins.Abstractions.csproj" />
<ProjectReference Include="..\StellaOps.Cryptography\StellaOps.Cryptography.csproj" />
<ProjectReference Include="..\StellaOps.Cryptography.Plugin.CryptoPro\StellaOps.Cryptography.Plugin.CryptoPro.csproj" />
<ProjectReference Include="..\StellaOps.Cryptography.Plugin.Pkcs11Gost\StellaOps.Cryptography.Plugin.Pkcs11Gost.csproj" />
<ProjectReference Include="..\StellaOps.Cryptography.DependencyInjection\StellaOps.Cryptography.DependencyInjection.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(StellaOpsEnableCryptoPro)' == 'true'">
<ProjectReference Include="..\StellaOps.Cryptography.Plugin.CryptoPro\StellaOps.Cryptography.Plugin.CryptoPro.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,7 +1,9 @@
using StellaOps.Cryptography;
using StellaOps.Cryptography.DependencyInjection;
using StellaOps.Cryptography.Plugin.CryptoPro;
using StellaOps.Cryptography.Plugin.Pkcs11Gost;
#if STELLAOPS_CRYPTO_PRO
using StellaOps.Cryptography.Plugin.CryptoPro;
#endif
namespace StellaOps.Configuration;
@@ -13,8 +15,9 @@ public sealed class StellaOpsCryptoOptions
public CryptoProviderRegistryOptions Registry { get; } = new();
public Pkcs11GostProviderOptions Pkcs11 { get; } = new();
#if STELLAOPS_CRYPTO_PRO
public CryptoProGostProviderOptions CryptoPro { get; } = new();
#endif
public string DefaultHashAlgorithm { get; set; } = HashAlgorithms.Sha256;
}

View File

@@ -4,8 +4,10 @@ using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options;
using StellaOps.Cryptography;
using StellaOps.Cryptography.DependencyInjection;
using StellaOps.Cryptography.Plugin.CryptoPro;
using StellaOps.Cryptography.Plugin.Pkcs11Gost;
#if STELLAOPS_CRYPTO_PRO
using StellaOps.Cryptography.Plugin.CryptoPro;
#endif
namespace StellaOps.Configuration;
@@ -30,11 +32,13 @@ public static class StellaOpsCryptoServiceCollectionExtensions
CopyPkcs11Options(target, resolved.Pkcs11);
});
#if STELLAOPS_CRYPTO_PRO
services.AddCryptoProGostProvider();
services.Configure<CryptoProGostProviderOptions>(target =>
{
CopyCryptoProOptions(target, resolved.CryptoPro);
});
#endif
services.Configure<CryptoHashOptions>(hash =>
{
@@ -90,6 +94,7 @@ public static class StellaOpsCryptoServiceCollectionExtensions
}
}
#if STELLAOPS_CRYPTO_PRO
private static void CopyCryptoProOptions(CryptoProGostProviderOptions target, CryptoProGostProviderOptions source)
{
target.Keys.Clear();
@@ -98,4 +103,5 @@ public static class StellaOpsCryptoServiceCollectionExtensions
target.Keys.Add(key.Clone());
}
}
#endif
}