Add certificate viewer plugin

Introduces QuickLook.Plugin.CertViewer for viewing certificate files (.pfx, .cer, .pem, etc.) in QuickLook. The plugin loads and displays certificate details or raw content, and is integrated into the solution and project files.
This commit is contained in:
ema
2025-12-23 14:15:52 +08:00
parent 154ec05528
commit dba41ac890
8 changed files with 390 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using System.Windows.Controls;
namespace QuickLook.Plugin.CertViewer;
public partial class CertViewerControl : UserControl, IDisposable
{
public CertViewerControl()
{
InitializeComponent();
}
public void LoadCertificate(X509Certificate2 cert)
{
var items = new List<KeyValuePair<string, string>>
{
new("Subject", cert.Subject),
new("Issuer", cert.Issuer),
new("Thumbprint", cert.Thumbprint),
new("SerialNumber", cert.SerialNumber),
new("NotBefore", cert.NotBefore.ToString()),
new("NotAfter", cert.NotAfter.ToString()),
new("SignatureAlgorithm", cert.SignatureAlgorithm.FriendlyName ?? cert.SignatureAlgorithm.Value),
new("PublicKey", cert.PublicKey.Oid.FriendlyName ?? cert.PublicKey.Oid.Value),
};
PropertyList.ItemsSource = items;
RawText.Text = string.Empty;
}
public void LoadRaw(string path, string message, string content)
{
PropertyList.ItemsSource = new List<KeyValuePair<string, string>>
{
new("Path", path),
new("Info", message)
};
RawText.Text = content ?? "(No content to display)";
}
public void Dispose()
{
}
}