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

Unable to load certificate, HTTPS / SSL issues #272

Open
AgrYpn1a opened this issue Apr 6, 2022 · 6 comments
Open

Unable to load certificate, HTTPS / SSL issues #272

AgrYpn1a opened this issue Apr 6, 2022 · 6 comments

Comments

@AgrYpn1a
Copy link

AgrYpn1a commented Apr 6, 2022

Hey,

We already discussed this in the previous post but it remained unresolved. I wonder if you could help. I am getting a nullptr exception here when trying to load a certificate. I've logged the certificate, and it's loaded correctly.

NullEmbedioscreenshot

@svanderbeck11
Copy link

svanderbeck11 commented Sep 12, 2022

Same issue here. If you simply try and log(SwanRuntime.OS) which look to be happening in the AutoRegister setter, it results in a "TypeInitializationException: The type initializer for 'Swan.SwanRuntime' threw an exception"

@rdeago rdeago transferred this issue from unosquare/embedio Sep 12, 2022
@rdeago
Copy link
Collaborator

rdeago commented Sep 12, 2022

I just transferred this issue from EmbedIO, since this is evidently an issue with Swan.Lite version 3.

Looking at the source code, I can't understand where this exception comes from. All SwanRuntime does at initialization is create some apparently innocent objects. Can anyone shed some light?

@geoperez
Copy link
Member

Are they trying to use HTTPS on Mac?

@svanderbeck11
Copy link

In my case it was Unity on Windows 10.

@cyanfish
Copy link

The issue is using Assembly.GetEntryAssembly() here, which can be null in various cases (e.g. unit tests).

private static readonly string ApplicationMutexName = "Global\\{{" + EntryAssembly.FullName + "}}";

In my case I found I didn't actually need to use AutoRegisterCertificate, my problem was that I was trying to use WithCertificate with a certificate that didn't have a private key attached (.crt) - generating the right type of certificate file (.pfx) made it work without needing to touch the system certificate store.

@AgrYpn1a
Copy link
Author

I ended up writing a C# wrapper around https://github.com/yhirose/cpp-httplib since none of the .NET solutions I've tried worked.

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

5 participants