How to create valid public and private key for digital sign?

277 views Asked by At

How i can get free X509 Certificates with true public and private key?
I use .net to encrypt and decrypt document.
Its can import pfx file.
And now how i can create single pfx file with public & private for each User?

1

There are 1 answers

0
Scott Chamberlain On BEST ANSWER

You need to use makecert and pvk2pfx, both get installed with visual studio.

First run makecert to get a certificate (cer file) and private key file (pvk file)

makecert -sv yourprivatekeyfile.pvk -n "cert name" yourcertfile.cer -b mm/dd/yyyy -e mm/dd/yyyy -r

where:

  • -sv yourprivatekeyfile.pvk is the name of the file containing the private key.
  • -n "cert name" is the name that will appear on the certificate (and in the certificate store).
  • yourcertfile.cer is the name of the certificate file.
  • -b mm/dd/yyyy is the date when the certificate becomes valid.
  • -e mm/dd/yyyy is the date when the certificate expires.
  • -r indicates that this will be a self-signed certificate.

One you have your two files you can combine them in to a pfx file

PVK2PFX –pvk yourprivatekeyfile.pvk –spc yourcertfile.cer –pfx yourpfxfile.pfx –po yourpfxpassword

where:

  • -pvk yourprivatekeyfile.pvk is the private key file that you created
  • -spc yourcertfile.cer is the certificate file you created
  • -pfx yourpfxfile.pfx is the name of the .pfx file that will be created.
  • -po yourpfxpassword is the password that you want to assign to the .pfx file.