Import Certificate Error (wodWebServer / wodWebServer.NET)
Hi there
wodWebServer.NET
SSL server example works fine with the provided certificate:
cert.Import(AppPath() + "\\certificate.pfx", "weonlydo", System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.Exportable);
web1.Certificate = cert;
any other certificate (self signed o standard) fails importing Private key with a inner exception 'System.Security.Cryptography.CryptographicException',
so cert.PrivateKey is null and the server won't start.
I tried with using powershell cmdlet, import export from computer certificate store, CreateCertificate API c#, but without luck.
How did you generate the sample certificate?
Thanks
Danny
Import Certificate Error
Hi Danny.
I just tried, for a test, with a certificate from selfsigned.org, works like a charm. I had following code and it works correctly with our SSL sample:
System.Security.Cryptography.X509Certificates.X509Certificate2 cert = new System.Security.Cryptography.X509Certificates.X509Certificate2();
cert.Import(AppPath() + "\\localhost.com.pfx", "password", System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.Exportable);
web1.Certificate = cert;
web1.Secure = true;
web1.SecureMethod = System.Security.Authentication.SslProtocols.Tls13;
web1.Start();
Import Certificate Error
Thanks Jasmine
it works.
Danny
Hi Danny.
I just tried, for a test, with a certificate from selfsigned.org, works like a charm. I had following code and it works correctly with our SSL sample:
System.Security.Cryptography.X509Certificates.X509Certificate2 cert = new System.Security.Cryptography.X509Certificates.X509Certificate2(); cert.Import(AppPath() + "\\localhost.com.pfx", "password", System.Security.Cryptography.X509Certificates.X509KeyStorageFlags.Exportable); web1.Certificate = cert; web1.Secure = true; web1.SecureMethod = System.Security.Authentication.SslProtocols.Tls13; web1.Start();