Add post-quantum cryptography support with PqSoftCryptoProvider
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
wine-csp-build / Build Wine CSP Image (push) Has been cancelled
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Concelier Attestation Tests / attestation-tests (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Policy Lint & Smoke / policy-lint (push) Has been cancelled
Scanner Analyzers / Discover Analyzers (push) Has been cancelled
Scanner Analyzers / Build Analyzers (push) Has been cancelled
Scanner Analyzers / Test Language Analyzers (push) Has been cancelled
Scanner Analyzers / Validate Test Fixtures (push) Has been cancelled
Scanner Analyzers / Verify Deterministic Output (push) Has been cancelled
wine-csp-build / Build Wine CSP Image (push) Has been cancelled
- Implemented PqSoftCryptoProvider for software-only post-quantum algorithms (Dilithium3, Falcon512) using BouncyCastle. - Added PqSoftProviderOptions and PqSoftKeyOptions for configuration. - Created unit tests for Dilithium3 and Falcon512 signing and verification. - Introduced EcdsaPolicyCryptoProvider for compliance profiles (FIPS/eIDAS) with explicit allow-lists. - Added KcmvpHashOnlyProvider for KCMVP baseline compliance. - Updated project files and dependencies for new libraries and testing frameworks.
This commit is contained in:
@@ -98,17 +98,17 @@ internal static class OrchestratorEventSerializer
|
||||
"newHigh",
|
||||
"kev"
|
||||
},
|
||||
[typeof(ReportLinksPayload)] = new[]
|
||||
{
|
||||
"report",
|
||||
"policy",
|
||||
"attestation"
|
||||
},
|
||||
[typeof(LinkTarget)] = new[]
|
||||
{
|
||||
"ui",
|
||||
"api"
|
||||
},
|
||||
[typeof(ReportLinksPayload)] = new[]
|
||||
{
|
||||
"report",
|
||||
"policy",
|
||||
"attestation"
|
||||
},
|
||||
[typeof(LinkTarget)] = new[]
|
||||
{
|
||||
"ui",
|
||||
"api"
|
||||
},
|
||||
[typeof(FindingSummaryPayload)] = new[]
|
||||
{
|
||||
"id",
|
||||
@@ -162,12 +162,12 @@ internal static class OrchestratorEventSerializer
|
||||
_inner = inner ?? throw new ArgumentNullException(nameof(inner));
|
||||
}
|
||||
|
||||
public JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions options)
|
||||
{
|
||||
var info = _inner.GetTypeInfo(type, options)
|
||||
?? throw new InvalidOperationException($"Unable to resolve JsonTypeInfo for '{type}'.");
|
||||
|
||||
if (info.Kind is JsonTypeInfoKind.Object && info.Properties is { Count: > 1 })
|
||||
public JsonTypeInfo GetTypeInfo(Type type, JsonSerializerOptions options)
|
||||
{
|
||||
var info = _inner.GetTypeInfo(type, options)
|
||||
?? throw new InvalidOperationException($"Unable to resolve JsonTypeInfo for '{type}'.");
|
||||
|
||||
if (info.Kind is JsonTypeInfoKind.Object && info.Properties is { Count: > 1 })
|
||||
{
|
||||
var ordered = info.Properties
|
||||
.OrderBy(property => GetOrder(type, property.Name))
|
||||
@@ -178,49 +178,53 @@ internal static class OrchestratorEventSerializer
|
||||
foreach (var property in ordered)
|
||||
{
|
||||
info.Properties.Add(property);
|
||||
}
|
||||
}
|
||||
|
||||
ConfigurePolymorphism(info);
|
||||
return info;
|
||||
}
|
||||
|
||||
private static int GetOrder(Type type, string propertyName)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
ConfigurePolymorphism(info);
|
||||
return info;
|
||||
}
|
||||
|
||||
private static int GetOrder(Type type, string propertyName)
|
||||
{
|
||||
if (PropertyOrder.TryGetValue(type, out var order) && Array.IndexOf(order, propertyName) is { } index and >= 0)
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
if (type.BaseType is not null)
|
||||
{
|
||||
return GetOrder(type.BaseType, propertyName);
|
||||
}
|
||||
|
||||
return int.MaxValue;
|
||||
}
|
||||
|
||||
private static void ConfigurePolymorphism(JsonTypeInfo info)
|
||||
{
|
||||
if (info.Type != typeof(OrchestratorEventPayload))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
info.PolymorphismOptions ??= new JsonPolymorphismOptions();
|
||||
|
||||
AddDerivedType(info.PolymorphismOptions, typeof(ReportReadyEventPayload));
|
||||
AddDerivedType(info.PolymorphismOptions, typeof(ScanCompletedEventPayload));
|
||||
}
|
||||
|
||||
private static void AddDerivedType(JsonPolymorphismOptions options, Type derivedType)
|
||||
{
|
||||
if (options.DerivedTypes.Any(d => d.DerivedType == derivedType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
options.DerivedTypes.Add(new JsonDerivedType(derivedType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type.BaseType is not null)
|
||||
{
|
||||
return GetOrder(type.BaseType, propertyName);
|
||||
}
|
||||
|
||||
return int.MaxValue;
|
||||
}
|
||||
|
||||
private static void ConfigurePolymorphism(JsonTypeInfo info)
|
||||
{
|
||||
if (info.Type != typeof(OrchestratorEventPayload))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
info.PolymorphismOptions ??= new JsonPolymorphismOptions();
|
||||
|
||||
AddDerivedType(info.PolymorphismOptions, typeof(ReportReadyEventPayload));
|
||||
AddDerivedType(info.PolymorphismOptions, typeof(ScanCompletedEventPayload));
|
||||
AddDerivedType(info.PolymorphismOptions, typeof(ScanStartedEventPayload));
|
||||
AddDerivedType(info.PolymorphismOptions, typeof(ScanFailedEventPayload));
|
||||
AddDerivedType(info.PolymorphismOptions, typeof(SbomGeneratedEventPayload));
|
||||
AddDerivedType(info.PolymorphismOptions, typeof(VulnerabilityDetectedEventPayload));
|
||||
}
|
||||
|
||||
private static void AddDerivedType(JsonPolymorphismOptions options, Type derivedType)
|
||||
{
|
||||
if (options.DerivedTypes.Any(d => d.DerivedType == derivedType))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
options.DerivedTypes.Add(new JsonDerivedType(derivedType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user