Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL: No credentials available in the security package #307

Open
ChristianKernDev opened this issue Jan 26, 2021 · 2 comments
Open

SSL: No credentials available in the security package #307

ChristianKernDev opened this issue Jan 26, 2021 · 2 comments

Comments

@ChristianKernDev
Copy link

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?

@AdrianBathurst
Copy link

Might have to use .pfx certificate file.
var certificate = new X509Certificate2("path-to-certificate.pfx", "certificate-password");

@ChristianKernDev
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants