.NET core X509Store on linux

The answer of @mbican is correct. the certificates are placed at

~/.dotnet/corefx/cryptography/x509stores/

I did not believe this one line answer without context and did not understand how he got there. That's why I want to share my findings as an answer for all the future visitors running in the same problem.

  1. Use the pfx certificate file, you do NOT have to convert it to a pem or crt or something

  2. Store the certificate with dotnet, so that you can see where the file is placed. A little C# command line:

    using (var store = new X509Store(StoreName.My, StoreLocation.CurrentUser, OpenFlags.ReadWrite))
    {
        store.Add(new X509Certificate2(
            "./thePathToTheCert.pfx", "passwordOfTheCert", 
            X509KeyStorageFlags.PersistKeySet));
    }
    

    This created the folder ~/.dotnet/corefx/cryptography/x509stores/ and placed the certificate inside. ~/.dotnet/corefx/cryptography/x509stores/my/ThumbPrintOfTheCertificate.pfx

    Hint: We used to use StoreLocation.LocalMachineon windows but when we run on linux there is no LocalMachine store, so we switched to StoreLocation.CurrentUser. You will get this error if you try LocalMachine: Unix LocalMachine X509Stores are read-only for all users.

Hope this helps someone.


~/.dotnet/corefx/cryptography/x509stores/