search and ai stabilization work, localization stablized.

This commit is contained in:
master
2026-02-24 23:29:36 +02:00
parent 4f947a8b61
commit b07d27772e
766 changed files with 55299 additions and 3221 deletions

View File

@@ -1,6 +1,7 @@
using Org.BouncyCastle.Crypto.Parameters;
using StellaOps.Cryptography;
using System;
using static StellaOps.Localization.T;
namespace StellaOps.Cryptography.Plugin.BouncyCastle;
@@ -10,7 +11,7 @@ public sealed partial class BouncyCastleEd25519CryptoProvider
{
if (!_supportedAlgorithms.Contains(algorithmId))
{
throw new InvalidOperationException($"Signing algorithm '{algorithmId}' is not supported by provider 'bouncycastle.ed25519'.");
throw new InvalidOperationException(_t("crypto.provider.algorithm_not_supported", algorithmId, "bouncycastle.ed25519"));
}
}
@@ -26,7 +27,7 @@ public sealed partial class BouncyCastleEd25519CryptoProvider
{
32 => span.ToArray(),
64 => span[..32].ToArray(),
_ => throw new InvalidOperationException("Ed25519 private key must be 32 or 64 bytes.")
_ => throw new InvalidOperationException(_t("crypto.ed25519.private_key_size"))
};
}
@@ -40,7 +41,7 @@ public sealed partial class BouncyCastleEd25519CryptoProvider
if (publicKey.Span.Length != 32)
{
throw new InvalidOperationException("Ed25519 public key must be 32 bytes.");
throw new InvalidOperationException(_t("crypto.ed25519.public_key_size"));
}
return publicKey.ToArray();

View File

@@ -4,6 +4,7 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using static StellaOps.Localization.T;
namespace StellaOps.Cryptography.Plugin.BouncyCastle;
@@ -38,10 +39,10 @@ public sealed partial class BouncyCastleEd25519CryptoProvider : ICryptoProvider
}
public ICryptoHasher GetHasher(string algorithmId)
=> throw new NotSupportedException("BouncyCastle Ed25519 provider does not expose hashing capabilities.");
=> throw new NotSupportedException(_t("crypto.ed25519.no_hashing"));
public IPasswordHasher GetPasswordHasher(string algorithmId)
=> throw new NotSupportedException("BouncyCastle provider does not expose password hashing capabilities.");
=> throw new NotSupportedException(_t("crypto.provider.no_password_hashing", Name));
public ICryptoSigner GetSigner(string algorithmId, CryptoKeyReference keyReference)
{
@@ -50,7 +51,7 @@ public sealed partial class BouncyCastleEd25519CryptoProvider : ICryptoProvider
if (!_signingKeys.TryGetValue(keyReference.KeyId, out var entry))
{
throw new KeyNotFoundException($"Signing key '{keyReference.KeyId}' is not registered with provider '{Name}'.");
throw new KeyNotFoundException(_t("crypto.provider.key_not_registered", keyReference.KeyId, Name));
}
EnsureAlgorithmSupported(algorithmId);
@@ -58,7 +59,7 @@ public sealed partial class BouncyCastleEd25519CryptoProvider : ICryptoProvider
if (!string.Equals(entry.Descriptor.AlgorithmId, normalized, StringComparison.OrdinalIgnoreCase))
{
throw new InvalidOperationException(
$"Signing key '{keyReference.KeyId}' is registered for algorithm '{entry.Descriptor.AlgorithmId}', not '{algorithmId}'.");
_t("crypto.provider.key_algorithm_mismatch", keyReference.KeyId, entry.Descriptor.AlgorithmId, algorithmId));
}
return new Ed25519SignerWrapper(entry);
@@ -71,7 +72,7 @@ public sealed partial class BouncyCastleEd25519CryptoProvider : ICryptoProvider
if (signingKey.Kind != CryptoSigningKeyKind.Raw)
{
throw new InvalidOperationException($"Provider '{Name}' requires raw Ed25519 private key material.");
throw new InvalidOperationException(_t("crypto.ed25519.raw_key_required", Name));
}
var privateKey = NormalizePrivateKey(signingKey.PrivateKey);

View File

@@ -13,5 +13,6 @@
<ItemGroup>
<ProjectReference Include="..\StellaOps.Cryptography\StellaOps.Cryptography.csproj" />
<ProjectReference Include="..\StellaOps.Plugin\StellaOps.Plugin.csproj" />
<ProjectReference Include="..\StellaOps.Localization\StellaOps.Localization.csproj" />
</ItemGroup>
</Project>