add PEM fix hack for windows

This commit is contained in:
uwaa 2024-11-04 12:15:04 +00:00
parent 181d77fc78
commit d48ce6742a

View file

@ -43,6 +43,12 @@ public sealed class HttpServer
public HttpServer(int port, X509Certificate? certificate, RouterBase router)
{
if (OperatingSystem.IsWindows() && certificate is X509Certificate2 cert)
{
//Hack because SslStream is stupid on windows
certificate = new X509Certificate2(cert.Export(X509ContentType.Pfx));
}
listener = new TcpListener(IPAddress.Any, port);
Certificate = certificate;
Router = router;