Description
After upgrading our company projects from .net core 3.1 to .net 6, X509Certificate2 class is unable to read data from certificates issued by two different polish electronic signature providers (KIR and Cencert). On windows everything works fine but on linux-based environments (so far tested on docker containers and WSL), Subject property always contains empty string.
Reproduction Steps
- Clone repository from https://github.com/afdsa213/certs-test into linux/wsl environment with .net sdk 6 installed,
- run xUnit tests inside X509Certificate2Tests class,
- both certificates fail on Assert.NotEmpty(subject)
Repository contains two certificates in DER format.

Expected behavior
Subject property of certificate object contains string with fields like CN, O, G, SN, C, etc.
Actual behavior
Subject property contains empty string.
Regression?
Worked fine in .net core 3.1 docker containers.
Known Workarounds
Writing custom parser, using AsnReader class (?) - but that seems like a lot of work.
Configuration
Tested on:
- WSL2 running Ubuntu 22.04.2 LTS with .net sdk 6.0.119,
- alpine linux docker containers with installed .net 6 runtime
Other information
No response