ln.http/ln.http/CertificateStore.cs

19 lines
598 B
C#

using System.Security.Cryptography.X509Certificates;
using ln.collections;
namespace ln.http;
public class CertificateStore
{
private Cache<string, X509Certificate> _cache = new Cache<string, X509Certificate>();
public CertificateStore()
{
}
public void AddCertificate(X509Certificate certificate) => _cache.Add(certificate.Subject, certificate);
public bool TryGetCertificate(string hostname, out X509Certificate certificate) =>
_cache.TryGetValue(hostname, out certificate);
public void RemoveCertificate(string hostname) => _cache.Remove(hostname);
}