0

I want to generate a self-signed SSL certificate in Windows and use it with my website for IE and Edge.

Two files .pvk and .cer needs to be inserted into the code of my website.

I followed this page, run the following commands, generated a powershellcert.pfx

$cert = New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname company.co.nz

$pwd = ConvertTo-SecureString -String ‘password1234’ -Force -AsPlainText

$path = ‘cert:\localMachine\my\’ + $cert.thumbprint

Export-PfxCertificate -cert $path -FilePath c:\junk\certificate\powershellcert.pfx -Password $pwd

Does anyone know how to generate .pvk and .cer?

Edit 1:

I downloaded PVKConverter, and run PVKConverter.exe -i powershellcert -o pvk -d "password1234", there is only one file pvk_1.cer generated.

Does anyone know how I could generate .pvk as well?

SoftTimur
  • 5,630
  • 38
  • 140
  • 292

3 Answers3

0

To generate .pvk and .cer files from the content of your .pfx file, use Microsoft's PVKConverter tool, downloadable from https://www.microsoft.com/en-us/download/details.aspx?id=40812

ottomeister
  • 5,415
  • 2
  • 23
  • 27
0

A well-known service for providing free SSL certificates is Let's Encrypt. Using openssl, you can just run the following command to generate a certificate in the folder you want them to be stored

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem 

(-x509 means x509 protocol; -days 365 for 1 year; -newkey is to generate a new key; rsa:2048 is to use the 2,048-bit RSA algorithm; -keyout is the kocation to place the key; -out is the location to place the certificate)

To note that you might still get "Not secure", "Invalid Certification Authority" warnings because they are self signed.


To install openssl on Windows go to openssl Wiki Binaries, then to the first link in the table, scroll down and you'll find installers for Windows, both 64 and 32 bits versions. Choose the version depending on your system, download and install.

Tiago Martins Peres
  • 14,289
  • 18
  • 86
  • 145
0

The simple way To Generate new SSL Certificate Open Powershell as administrator run the below command

New-SelfSignedCertificate -CertStoreLocation C:\certificates -DnsName "Instance_Name" -FriendlyName "My First Next JSS APP" -NotAfter (Get-Date).AddYears(10)

To check if the self signed certificate is generated goto run and type mmc File>Add/Remove Snap Select Certificate click OK Now, check the certificate in Personal and Trusted Root Certification Authorities if not present in anyone copy and paste