avatar Bipul Raman Engineer | Speaker

Create Self-Signed Certificate (.cer & .pfx)
Posted by Bipul Raman on October 18, 2018.

Steps to create self signed certificate on Windows:
  1. Open visual studio Developer Command Prompt as administrator  
  2. Execute below mentioned commands in sequential order. It will create a certificate with SHA.256 algorithm.You can modify parameters as per your requirements.
    Command format:
    makecert –a SHA256 -sv SAMPLE.pvk -n "cn=SAMPLE" SAMPLE.cer -b <start_date> -e <end_date> -r
    pvk2pfx -pvk SAMPLE.pvk -spc SAMPLE.cer -pfx SAMPLE.pfx
    Example:
    makecert –a SHA256 -sv "C:\Sample.pvk" -n "cn=Sample" "C:\Sample.cer" -b "10/22/2018" -e "10/22/2019" -r
    pvk2pfx -pvk "C:\Sample.pvk" -spc "C:\Sample.cer" -pfx "C:\Sample.pfx"
  3. Install the pfx file for current machine or current user as per requirements
References:
  1. https://docs.microsoft.com/en-us/windows/desktop/SecCrypto/makecert
  2. https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/pvk2pfx

UPDATE: (April 15, 2019)
Use this powershell command to create self signed certificate as MAKECERT command has been depretiated.