Add PKCS#11 startup self-test health reporting

This commit is contained in:
2026-10-14 13:49:38 +02:00
parent 8f2744afc7
commit b8a96330c0
13 changed files with 259 additions and 25 deletions

View File

@@ -8,7 +8,7 @@ internal static class Pkcs11ToolBridge
{
public static bool IsAvailable(Pkcs11Options options)
{
return !string.IsNullOrWhiteSpace(options.ToolPath) && File.Exists(options.ToolPath);
return !string.IsNullOrWhiteSpace(options.ResolvedToolPath) && File.Exists(options.ResolvedToolPath);
}
public static byte[] ReadCertificateBytes(Pkcs11Options options)
@@ -75,7 +75,7 @@ internal static class Pkcs11ToolBridge
var args = new List<string>
{
"--module",
options.LibraryPath,
options.ResolvedLibraryPath,
"--login",
"--pin",
options.UserPin
@@ -101,7 +101,7 @@ internal static class Pkcs11ToolBridge
{
StartInfo = new ProcessStartInfo
{
FileName = options.ToolPath!,
FileName = options.ResolvedToolPath!,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
@@ -136,7 +136,7 @@ internal static class Pkcs11ToolBridge
private static void EnsureAvailable(Pkcs11Options options)
{
if (!IsAvailable(options))
throw new InvalidOperationException("pkcs11-tool is not available. Configure Crypt:Pkcs11:ToolPath.");
throw new InvalidOperationException("pkcs11-tool is not available at resolved pkcs11 assets path.");
}
private static void DeleteIfExists(string path)