I know the original issue was on Linux, however I encountered the same problem on Windows 11 (fresh install). The root cause in my case was that the directory %APPDATA%\ASP.NET\https was missing. Creating it fixed the issue and the certificate was exported. It seems that the tool aspnetcore-https is not able to create a directory when exporting certs.