Hello I deploy my app on linux, but I found problem with loading certificate with password doesn't work when I start my app server side.
Exampale:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
var cert = new X509Certificate2("/etc/ssl/certs/certificate.pfx","******"); // doesn't work
webBuilder.UseStartup<Startup>();
webBuilder.ConfigureKestrel(serverOoptions =>
. . . . . . .
Unhandled exception. Interop+Crypto+OpenSslCryptographicException: error:2006D002:BIO routines:BIO_new_file:system lib
at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle)
at Internal.Cryptography.Pal.OpenSslX509CertificateReader.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password)
at GrpcService.Program.<>c.<CreateHostBuilder>b__4_0(IWebHostBuilder webBuilder) in D:\GrpcService\Program.cs:line 56
at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.<>c__DisplayClass0_0.<ConfigureWebHostDefaults>b__0(IWebHostBuilder webHostBuilder)
at Microsoft.Extensions.Hosting.GenericHostWebHostBuilderExtensions.ConfigureWebHost(IHostBuilder builder, Action1 configure, Action
1 configureWebHostBuilder)
at Microsoft.Extensions.Hosting.GenericHostWebHostBuilderExtensions.ConfigureWebHost(IHostBuilder builder, Action1 configure) at Microsoft.Extensions.Hosting.GenericHostBuilderExtensions.ConfigureWebHostDefaults(IHostBuilder builder, Action
1 configure)
at GrpcService.Program.CreateHostBuilder(String[] args) in D:\GrpcService\Program.cs:line 53
at GrpcService.Program.Main(String[] args) in D:\GrpcService\Program.cs:line 29
Aborted
And if load certificate without password app good working.
What happened?
Any tips, thank's!