Difference between revisions of "Creating .NET Core Certificates"

From Logic Wiki
Jump to: navigation, search
Line 4: Line 4:
 
[[Category:Security]]
 
[[Category:Security]]
 
[[Category:SSL]]
 
[[Category:SSL]]
 +
== Cleaning Certificate ==
 +
dotnet dev-certs https --clean
  
 
== Generating a certificate ==
 
== Generating a certificate ==

Revision as of 11:31, 3 November 2021

Cleaning Certificate

dotnet dev-certs https --clean

Generating a certificate

Generating a certificate and export it to USERPROFILE path (-ep : export path) SignAPI.pfx should case sensitive and must match the dll name

dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\SignAPI.pfx -p pa55w0rd!

you should see this

A valid HTTPS certificate is already present.

so ...

dotnet dev-certs https --trust

if it's already there this must be seen

Trusting the HTTPS development certificate was requested. A confirmation prompt will be displayed if the certificate was not previously trusted. Click yes on the prompt to trust the certificate.
A valid HTTPS certificate is already present.

User Secrets

in .csproj file after <TargetFramework> tag add this with a newly generated GUID

 <UserSecretId>Sign-API-[GUID]</UserSecretId>

Setting Secret

in the project folder where .csproj file is :

dotnet user-secrets set "Kestrel:Certificates:Development:Password" "pa55w0rd!"

it should say

Successfully saved Kestrel:Certificates:Development:Password = pa55w0rd! to the secret store.

and the secret is saved in C:\Users\<ProfileFolder>\AppData\Roaming\Microsoft\UserSecrets\Sign-API-[GUID]