Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file

Viewed 12668

Server is in Linux but we tried to publish .net core folder. It's working fine in IIS but not working in Linux server. We are following below manner of project deployment to google server.

https://cloud.google.com/blog/products/gcp/4-ways-you-can-deploy-an-aspnet-core-app-to-gcp

Tried since 4 days. I need to convert my certificate read code into linux sever mode is below.

string base64str = Convert.ToBase64String(Certificate);
X509Certificate2 certificate = new X509Certificate2(baseBytes, "notasecret", X509KeyStorageFlags.Exportable);

We are used above line for generating signed url of which file are stored at google repositories.

1 Answers

I had the same error when running docker locally and what fixed it is by specifying the cert and password.

docker run -i -p 443:443 -e ASPNETCORE_Kestrel__Certificates__Default__Path="name_of_file.pfx" -e ASPNETCORE_Kestrel__Certificates__Default__Password="password_here"

Note that you need to specify the correct case in the filename and also use double quotes and not single quotes. No quotes also work but if the text needs escaping then it will be trouble so better use double quotes.

Related