Fix build and code structure improvements. New but essential UI functionality. CI improvements. Documentation improvements. AI module improvements.

This commit is contained in:
StellaOps Bot
2025-12-26 21:54:17 +02:00
parent 335ff7da16
commit c2b9cd8d1f
3717 changed files with 264714 additions and 48202 deletions

View File

@@ -11,7 +11,6 @@ using Microsoft.Extensions.DependencyInjection;
using StellaOps.Cryptography.DependencyInjection;
using StellaOps.Cryptography.Plugin.BouncyCastle;
using Xunit;
using Xunit.Abstractions;
namespace StellaOps.Cryptography.Tests;

View File

@@ -1,4 +1,4 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using StellaOps.Cryptography;
using StellaOps.Cryptography.DependencyInjection;
@@ -22,7 +22,6 @@ public sealed class BouncyCastleEd25519CryptoProviderTests
services.AddBouncyCastleEd25519Provider();
using var provider = services.BuildServiceProvider();
using StellaOps.TestKit;
var registry = provider.GetRequiredService<ICryptoProviderRegistry>();
var bcProvider = provider.GetServices<ICryptoProvider>()
.OfType<BouncyCastleEd25519CryptoProvider>()

View File

@@ -11,7 +11,6 @@ using Microsoft.Extensions.DependencyInjection;
using StellaOps.Cryptography.DependencyInjection;
using StellaOps.Cryptography.Plugin.BouncyCastle;
using Xunit;
using Xunit.Abstractions;
namespace StellaOps.Cryptography.Tests;

View File

@@ -13,7 +13,6 @@ using StellaOps.Cryptography.Plugin.BouncyCastle;
using System.Security.Cryptography;
using System.Text;
using Xunit;
using Xunit.Abstractions;
namespace StellaOps.Cryptography.Tests;

View File

@@ -5,10 +5,10 @@
// Description: Capability detection tests for CryptoPro GOST crypto plugin
// -----------------------------------------------------------------------------
using System.Runtime.Versioning;
using FluentAssertions;
using Microsoft.Extensions.Options;
using Xunit;
using Xunit.Abstractions;
namespace StellaOps.Cryptography.Tests;
@@ -21,6 +21,7 @@ namespace StellaOps.Cryptography.Tests;
[Trait("Category", "CryptoPro")]
[Trait("Category", "GOST")]
[Trait("Category", "C1")]
[SupportedOSPlatform("windows")]
public sealed class CryptoProCapabilityDetectionTests
{
private readonly ITestOutputHelper _output;

View File

@@ -1,4 +1,4 @@
#if STELLAOPS_CRYPTO_PRO
#if STELLAOPS_CRYPTO_PRO
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
@@ -31,7 +31,6 @@ public class CryptoProGostSignerTests
var request = new CertificateRequest("CN=stellaops.test", ecdsa, HashAlgorithmName.SHA256);
using var cert = request.CreateSelfSigned(DateTimeOffset.UtcNow.AddDays(-1), DateTimeOffset.UtcNow.AddDays(1));
using StellaOps.TestKit;
var entry = new CryptoProGostKeyEntry(
"test-key",
SignatureAlgorithms.GostR3410_2012_256,

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
@@ -84,7 +84,6 @@ public sealed class DefaultCryptoHashTests
var hash = CryptoHashFactory.CreateDefault();
var expected = Convert.ToHexStringLower(SHA256.HashData(Sample));
await using var stream = new MemoryStream(Sample);
using StellaOps.TestKit;
var actual = await hash.ComputeHashHexAsync(stream, HashAlgorithms.Sha256);
Assert.Equal(expected, actual);
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
@@ -32,7 +32,6 @@ public sealed class DefaultCryptoHmacTests
var hmac = DefaultCryptoHmac.CreateForTests();
var expected = Convert.ToHexStringLower(HMACSHA256.HashData(Key, Sample));
await using var stream = new MemoryStream(Sample);
using StellaOps.TestKit;
var actual = await hmac.ComputeHmacHexForPurposeAsync(Key, stream, HmacPurpose.WebhookInterop);
Assert.Equal(expected, actual);
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
@@ -61,7 +61,6 @@ public class DefaultCryptoProviderSigningTests
{
var provider = new DefaultCryptoProvider();
using var ecdsa = ECDsa.Create(ECCurve.NamedCurves.nistP256);
using StellaOps.TestKit;
var parameters = ecdsa.ExportParameters(true);
var signingKey = new CryptoSigningKey(new CryptoKeyReference("key-to-remove"), SignatureAlgorithms.Es256, in parameters, DateTimeOffset.UtcNow);

View File

@@ -13,7 +13,6 @@ using StellaOps.Cryptography.Plugin.EIDAS;
using StellaOps.Cryptography.Plugin.EIDAS.Configuration;
using StellaOps.Cryptography.Plugin.EIDAS.Models;
using Xunit;
using Xunit.Abstractions;
namespace StellaOps.Cryptography.Tests;

View File

@@ -8,7 +8,6 @@
using FluentAssertions;
using StellaOps.Cryptography.Kms;
using Xunit;
using Xunit.Abstractions;
namespace StellaOps.Cryptography.Tests;
@@ -119,7 +118,7 @@ public sealed class KmsHsmConnectorTests
{
var provider = CreateProvider(new MockKmsClient());
var keyReference = new CryptoKeyReference("kms-key-001", provider.Name);
var metadata = new Dictionary<string, string?> { [KmsMetadataKeys.Version] = "v1" };
var metadata = new Dictionary<string, string?> { ["kms.version"] = "v1" };
var signingKey = new CryptoSigningKey(
keyReference,
KmsAlgorithms.Es256,
@@ -158,7 +157,7 @@ public sealed class KmsHsmConnectorTests
{
var provider = CreateProvider(new MockKmsClient());
var keyReference = new CryptoKeyReference("kms-key-001", provider.Name);
var metadata = new Dictionary<string, string?> { [KmsMetadataKeys.Version] = "v1" };
var metadata = new Dictionary<string, string?> { ["kms.version"] = "v1" };
var signingKey = new CryptoSigningKey(
keyReference,
SignatureAlgorithms.Ed25519,
@@ -231,7 +230,7 @@ public sealed class KmsHsmConnectorTests
var signer = provider.GetSigner(KmsAlgorithms.Es256, keyReference);
signer.Should().NotBeNull();
signer.Should().BeOfType<KmsSigner>();
signer.Should().BeAssignableTo<ICryptoSigner>();
_output.WriteLine("✓ GetSigner returns KmsSigner");
}
@@ -401,7 +400,7 @@ public sealed class KmsHsmConnectorTests
private static void RegisterKey(KmsCryptoProvider provider, string keyId)
{
var keyReference = new CryptoKeyReference(keyId, provider.Name);
var metadata = new Dictionary<string, string?> { [KmsMetadataKeys.Version] = "v1" };
var metadata = new Dictionary<string, string?> { ["kms.version"] = "v1" };
var signingKey = new CryptoSigningKey(
keyReference,
KmsAlgorithms.Es256,
@@ -432,7 +431,7 @@ public sealed class KmsHsmConnectorTests
var signatureKey = $"{keyId}:{keyVersion}:{Convert.ToBase64String(data.ToArray())}";
_signatures[signatureKey] = signature;
return Task.FromResult(new KmsSignResult(keyId, keyVersion ?? "v1", signature));
return Task.FromResult(new KmsSignResult(keyId, keyVersion ?? "v1", KmsAlgorithms.Es256, signature));
}
public Task<bool> VerifyAsync(
@@ -448,12 +447,20 @@ public sealed class KmsHsmConnectorTests
public Task<KmsKeyMetadata> GetMetadataAsync(string keyId, CancellationToken cancellationToken = default)
{
var versions = System.Collections.Immutable.ImmutableArray.Create(
new KmsKeyVersionMetadata(
"v1",
KmsKeyState.Active,
DateTimeOffset.UtcNow.AddMonths(-1),
null,
string.Empty,
"P-256"));
var metadata = new KmsKeyMetadata(
keyId,
"v1",
KmsAlgorithms.Es256,
KmsKeyState.Active,
DateTimeOffset.UtcNow.AddMonths(-1),
null);
versions);
return Task.FromResult(metadata);
}
@@ -466,20 +473,31 @@ public sealed class KmsHsmConnectorTests
var material = new KmsKeyMaterial(
keyId,
keyVersion ?? "v1",
X: new byte[32],
Y: new byte[32],
D: Array.Empty<byte>());
KmsAlgorithms.Es256,
"P-256",
D: Array.Empty<byte>(),
Qx: new byte[32],
Qy: new byte[32],
DateTimeOffset.UtcNow.AddMonths(-1));
return Task.FromResult(material);
}
public Task<KmsKeyMetadata> RotateAsync(string keyId, CancellationToken cancellationToken = default)
{
var versions = System.Collections.Immutable.ImmutableArray.Create(
new KmsKeyVersionMetadata(
"v2",
KmsKeyState.Active,
DateTimeOffset.UtcNow,
null,
string.Empty,
"P-256"));
var metadata = new KmsKeyMetadata(
keyId,
"v2",
KmsAlgorithms.Es256,
KmsKeyState.Active,
DateTimeOffset.UtcNow,
null);
versions);
return Task.FromResult(metadata);
}

View File

@@ -1,4 +1,4 @@
#if STELLAOPS_CRYPTO_SODIUM
#if STELLAOPS_CRYPTO_SODIUM
using System;
using System.Security.Cryptography;
using System.Text;
@@ -17,7 +17,6 @@ public class LibsodiumCryptoProviderTests
{
var provider = new LibsodiumCryptoProvider();
using var ecdsa = ECDsa.Create(ECCurve.NamedCurves.nistP256);
using StellaOps.TestKit;
var parameters = ecdsa.ExportParameters(includePrivateParameters: true);
var signingKey = new CryptoSigningKey(

View File

@@ -1,4 +1,4 @@
#if STELLAOPS_PKCS11
#if STELLAOPS_PKCS11
using System;
using System.IO;
using System.Security.Cryptography;
@@ -23,7 +23,6 @@ public class Pkcs11GostProviderTests
}
using var ecdsa = ECDsa.Create(ECCurve.NamedCurves.nistP256);
using StellaOps.TestKit;
var req = new CertificateRequest("CN=pkcs11.test", ecdsa, HashAlgorithmName.SHA256);
var cert = req.CreateSelfSigned(DateTimeOffset.UtcNow.AddDays(-1), DateTimeOffset.UtcNow.AddDays(1));

View File

@@ -10,7 +10,6 @@ using Microsoft.Extensions.Options;
using Moq;
using StellaOps.Cryptography.Plugin.SimRemote;
using Xunit;
using Xunit.Abstractions;
namespace StellaOps.Cryptography.Tests;
@@ -388,7 +387,7 @@ public sealed class SimRemoteCapabilityDetectionTests
foreach (var key in keys)
{
key.ProviderName.Should().Be("sim.crypto.remote");
key.Provider.Should().Be("sim.crypto.remote");
key.Metadata.Should().ContainKey("simulation");
key.Metadata["simulation"].Should().Be("true");
}
@@ -459,8 +458,7 @@ public sealed class SimRemoteCapabilityDetectionTests
private static SimRemoteHttpClient CreateMockHttpClient()
{
var httpClient = new HttpClient();
var options = Options.Create(new SimRemoteProviderOptions());
return new SimRemoteHttpClient(httpClient, options);
return new SimRemoteHttpClient(httpClient);
}
#endregion

View File

@@ -6,9 +6,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<Using Include="Xunit.Abstractions" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Moq" />
<PackageReference Include="xunit.runner.visualstudio" >
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
@@ -20,7 +24,11 @@
<ProjectReference Include="..\..\StellaOps.Cryptography.Plugin.BouncyCastle\StellaOps.Cryptography.Plugin.BouncyCastle.csproj" />
<ProjectReference Include="..\..\StellaOps.Cryptography.Plugin.OfflineVerification\StellaOps.Cryptography.Plugin.OfflineVerification.csproj" />
<ProjectReference Include="..\..\StellaOps.Cryptography.Plugin.OpenSslGost\StellaOps.Cryptography.Plugin.OpenSslGost.csproj" />
<ProjectReference Include="..\..\StellaOps.Cryptography.Plugin.SimRemote\StellaOps.Cryptography.Plugin.SimRemote.csproj" />
<ProjectReference Include="..\..\StellaOps.Cryptography.Plugin.SmSoft\StellaOps.Cryptography.Plugin.SmSoft.csproj" />
<ProjectReference Include="..\..\StellaOps.Cryptography.Plugin.EIDAS\StellaOps.Cryptography.Plugin.EIDAS.csproj" />
<ProjectReference Include="..\..\StellaOps.Cryptography.Kms\StellaOps.Cryptography.Kms.csproj" />
<ProjectReference Include="..\..\StellaOps.Cryptography.Plugin.CryptoPro\StellaOps.Cryptography.Plugin.CryptoPro.csproj" />
<ProjectReference Include="../../StellaOps.TestKit/StellaOps.TestKit.csproj" />
</ItemGroup>
</Project>
</Project>