Skip to content

Cannot access certificate store #6

@skolmer

Description

@skolmer

I already posted this on the azure feedback forums: https://feedback.azure.com/forums/169385-web-apps/suggestions/18668707--linux-allow-to-access-certicate-store-within-lin

Feel free to close this issue if it is better handled via the feedback forum.

Using certificates uploaded via the azure portal in a Linux based .NET core app is currently not possible.
Normally you would do something like this to access those certificates (https://azure.microsoft.com/en-us/blog/using-certificates-in-azure-websites-applications/):

using(var certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser)) {
      certStore.Open(OpenFlags.ReadOnly);
      X509Certificate2Collection certCollection = certStore.Certificates.Find(
                                 X509FindType.FindByThumbprint,
                                 // Replace below with your cert's thumbprint
                                 “E661583E8FABEF4C0BEF694CBC41C28FB81CD870”,
                                 false);
      // Get the first cert with the thumbprint
      if (certCollection.Count > 0)
      {
        X509Certificate2 cert = certCollection[0];
        // Use certificate
        Console.WriteLine(cert.FriendlyName);
      }
}

In .NET core 1.1 apps this is not working as expected the X509Store certificates collection is always empty. Maybe I'm just missing a configuration setting but already tried everything described in the blogpost above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions