# ASP.NET Core developer certificate is not trusted

**URL:** https://discourse.nixos.org/t/asp-net-core-developer-certificate-is-not-trusted/27875
**Category:** Help
**Created:** [May 4, 2023, 5:43pm UTC](https://discourse.nixos.org/t/asp-net-core-developer-certificate-is-not-trusted/27875 "2023-05-04T17:43:15Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![EzekielEnns](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ezekielenns/32/17730_2.png) [@EzekielEnns](https://discourse.nixos.org/u/EzekielEnns)
#### Post date: [May 8, 2024, 3:01pm UTC](https://discourse.nixos.org/t/asp-net-core-developer-certificate-is-not-trusted/27875/4 "2024-05-08T15:01:41Z")

</div>

This took way too long to figure out:

- go to your dotnet project
- run `dotnet dev-certs https --format PEM -ep server.crt` note name dose not matter
- cat that out and copy it to your clip board `cat server.crt` or pipe to clip  
in your nixos config:

```auto
      security.pki.certificates= [
''
-----BEGIN CERTIFICATE-----
past her in
-----END CERTIFICATE-----
''
];

```

do a `sudo nixos-rebuild switch` might need to reboot, on your next dotnet run you will still see the warning saying your cert is not trusted this can be ignored  
note this is only for service to service, for chrome or anything like that you will need to deal with this differently I strongly recommend doing `chromium --allow-insecure-localhost localhostURL` to deal with that

So why does this one work and not the other one?  
Well this [comment](https://discourse.nixos.org/t/help-adding-a-ca-certificate-with-security-pki-certificatefiles/25131/5) seems to mention how certificateFiles requries a Certificate Authority (CA) but these dev certs do not have them, so somehow some way self-signed certs work with this config option and not the other (check the comment there might be an explanation there)

---

_[View the full topic](https://discourse.nixos.org/t/asp-net-core-developer-certificate-is-not-trusted/27875)._
