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

Using Fleck in .NET core app with SSL certificate #297

Open
captain-bugs opened this issue Aug 17, 2020 · 2 comments
Open

Using Fleck in .NET core app with SSL certificate #297

captain-bugs opened this issue Aug 17, 2020 · 2 comments

Comments

@captain-bugs
Copy link

I have already used this library with SSL in .NET Framework. But I'm planing to use in my .NET core app and I was wondering how can I use SSL (.pem format) certificate since I want to run the application on a Linux machine. Earlier I converted the SSL certificate from .pem to .pfx.
Will it still work on Linux machines if i used the .pfx format ?

@AdrianBathurst
Copy link

Not sure, but probably not. I had this running on on Linux/.NET Framework (Mono) a long time ago. Though I was running this with SSL being stopped at Nginx, so SSL from client to Nginx, non SSL from Nginx to socket server. "Reverse Proxy" may be a route to tackle if you have issues.

@RobertoMachorro
Copy link

Try this and see if it works for you:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout certificate.key -out certificate.crt
openssl pkcs12 -export -out certificate.pfx -inkey certificate.key -in certificate.crt
openssl pkcs12 -in certificate.pfx -out certificate.pem -cacerts

I use PFX with Fleck, though:

var address = String.Format("wss://0.0.0.0:{0}", this._port);
var server = new WebSocketServer(address);
var certpath = System.IO.Path.Combine(Environment.CurrentDirectory, "certificate.pfx");
server.Certificate = new System.Security.Cryptography.X509Certificates.X509Certificate2(certpath, String.Empty);

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

3 participants