how to create a completely new x509Certificate2 in .net?

后端 未结 6 1771
忘了有多久
忘了有多久 2020-12-14 08:07

I google it from web, find many samples to generate a new x509Certificate2 from a file in .net, but there is no one sample to show how to generate a completely new x509Certi

6条回答
  •  攒了一身酷
    2020-12-14 08:25

    Open ssl for creating x509 certificate

    1.Download the Win64 Openssl from the below link.(Win64 OpenSSL v1.1.0j - 37mb installer) URL - https://slproweb.com/products/Win32OpenSSL.html

    2.After installation set the system path environment variable.(path = C:\OpenSSL-Win64\bin)

    3.Open command prompt and change the directory to desktop.

    4.Command for key creation : Private Key : openssl req -x509 -days 365 -newkey rsa:2048 -keyout cert-key.pem -out cert.pem Enter the command and follow the instruction.

    5.Now we have 2 files named cert-key.pem and cert.pem in desktop. To create the .pfx file run the below command openssl pkcs12 -export -in cert.pem -inkey cert-key.pem -out x509-cert.pfx and follow the instruction(enter the same password).

    6.Command for public key creation : openssl pkcs12 -in x509-cert.pfx -clcerts -nokeys -out x509-cert-public.pem and follow the instruction.

    7.Register the certificate to mmc.

提交回复
热议问题