Search code examples
asp.net-coregrpc-dotnet

How to specify a certificate in the cert store for gRPC .NET Core?


I'm trying to specify a certificate in the cert store for gRPC .NET Core 3.1.

I found a way to specify a certificate by setting the path.

https://medium.com/@mcilis/how-to-publish-net-core-grpc-server-as-a-windows-service-dd562a1e263d

    "Certificates": {
        "Default": {
            "Path": "Your_Path_To_Certificate_Pfx",
            "Password": "Pfx_File_Password"
        }
    }

But is it possible to specify one in the Windows Certificate store with appsettings.json? Or is it possible only by code?


Solution

  • I found an answer when I saw a stack trace.

    CertificateConfig

    https://github.com/dotnet/aspnetcore/blob/a190fd34854542266956b1af980c19afacb95feb/src/Servers/Kestrel/Core/src/Internal/ConfigurationReader.cs

    These are the parameters for the Windows certificate store.

    • Subject
    • Store
    • Location
    • AllowInvalid