Add password support for protected certificates
Some checks failed
build / build (push) Has been cancelled
build / publish (push) Has been cancelled

Introduces UI and logic to handle password-protected certificate files. The CertViewerControl now prompts for a password if needed, and attempts to reload the certificate with the provided password. Refactored certificate loading flow to support this feature.
This commit is contained in:
ema
2025-12-23 14:41:59 +08:00
parent 59f07a6cf3
commit 06694e0b16
5 changed files with 106 additions and 37 deletions

View File

@@ -8,15 +8,17 @@ internal sealed class CertLoadResult
public X509Certificate2 Certificate { get; }
public string Message { get; }
public string RawContent { get; }
public bool NeedsPassword { get; }
public CertLoadResult(bool success, X509Certificate2 certificate, string message, string rawContent)
public CertLoadResult(bool success, X509Certificate2 certificate, string message, string rawContent, bool needsPassword = false)
{
Success = success;
Certificate = certificate;
Message = message;
RawContent = rawContent;
NeedsPassword = needsPassword;
}
public static CertLoadResult From(bool success, X509Certificate2 certificate, string message, string rawContent)
=> new CertLoadResult(success, certificate, message, rawContent);
public static CertLoadResult From(bool success, X509Certificate2 certificate, string message, string rawContent, bool needsPassword = false)
=> new CertLoadResult(success, certificate, message, rawContent, needsPassword);
}