mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-01-14 05:00:28 +08:00
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.
25 lines
871 B
C#
25 lines
871 B
C#
using System.Security.Cryptography.X509Certificates;
|
|
|
|
namespace QuickLook.Plugin.CertViewer;
|
|
|
|
internal sealed class CertLoadResult
|
|
{
|
|
public bool Success { get; }
|
|
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, 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, bool needsPassword = false)
|
|
=> new CertLoadResult(success, certificate, message, rawContent, needsPassword);
|
|
}
|