Generating a Self-Signed Certificate using Powershell
A self-signed certificate it's very easy to create and helps on with local development and testing.
With a Single Line of PowerShell code we create a certificate.
First, open the PowerShell
as Administrator and run the following command:
The default expiration is 1 year. If you want a custom expiration date use option -NotAfter
.
That is it. Done!! The certificate was created and stored in our Certificate Store
of Windows.
Note the parameter "CertStoreLocation", this is where the cert will be stored. cert:\LocalMachine means Local Machine Cert store.
Now let's export it as a .pfx
file into a local directory.
In the same PowerShell window run the following commands.
In my scenario, the cert name is rmauro.dev. Change it to yours.
Check the directory temp to find the certificate - rmauro.dev.pfx
.
Leave a comment / Subscribe!