Fleck
Fleck copied to clipboard
SSL: No credentials available in the security package
I try to use SSL for my WebSocket connection and therefore i use this setup:
var server = new WebSocketServer("wss://0.0.0.0:8181");
var config = BuildConfig();
server.Certificate = X509Certificate2.CreateFromPemFile("fullchain.pem","privkey.pem");
Everything seems fine log says:
Using default TLS 1.0 security protocol.
The problem is, that as soon as a client tries to connect an exception is thrown:
System.ComponentModel.Win32Exception (0x8009030E): No credentials available in the security package.
I use .NET 5.0, is there any known fix for this?
Might have to use .pfx certificate file.
var certificate = new X509Certificate2("path-to-certificate.pfx", "certificate-password");
Yes that fixed it indeed. I wonder if there is a way to make it work with .pem certificates, because i use Certbot to autoamtically recreate the certificates for my domain and now i have to manually convert it to a pfx cert each time a new certificate is generated.