How to install a ssl sertificate from diffrent server to my server,

做~自己de王妃 提交于 2019-12-08 10:58:19

问题


I want to create a website in my IIS server, (website already has ssl certificate). So i created a site, I have the certificate details which contains certificate, private key , CA certificate (all in one text file).

I havent created a csr request for this, But i need to install this certififcate in my system.

When i followed the steps in complete cerififcate request, first it got added, but when i refresh and came back it was gone.

Please help me how to install certififcate from other server, without creating csr request.?

i have: 1)Certificate: 2)Private key (.key) 3)CA certificate (-ca.crt)

in the text file.


回答1:


You need to convert the text file into *.pfx file so that you can import it on IIS

Open the .key via notepad copy the content and save it in a new notepad say abc.txt

-----BEGIN PRIVATE KEY----- MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDJl/Dwe2tzd5Z6 L4fWpUDVP6FDE9Tc0ViHlICsopxPumysltLwuLFCsc9gCOOURc6n0ej2XQoBJeuetqTIRZQ3VOlHqcmxdBTaAxw5iQ== -----END PRIVATE KEY-----

Now open the certificate via notepad copy the content and paste it in the same abc.txt notepad

-----BEGIN CERTIFICATE----- MIIG5jCCBc6gAwIBAgIQUERflom9AJ4ssjDKLPM3SDANBgkqhkiG9w0BAQsFADBB bS9jcHMwLwYIKwYBBQUHAgIwIwwhaHR0cHM6Ly93d3cudGhhd3RlLmNvbS9yZXBv SzBJMB8GCCsGAQUFBzABhhNodHRwOi8vdGouc3ltY2QuY29tMCYGCCsGAQUFBzAC B7MDaIXp7iniBRfFT3MOMm2Bs3Mju2Hwfhrgg7sf96iQzZkzAU6Mxdux -----END CERTIFICATE-----

Open the -ca.crt via notepad copy the content and paste it in the same abc.txt file (this file will contain intermediate and root certificates)

-----BEGIN CERTIFICATE----- MIIG5jCCBc6gAwIBAgIQUERflom9AJ4ssjDKLPM3SDANBgkqhkiG9w0BAQsFADBB bS9jcHMwLwYIKwYBBQUHAgIwIwwhaHR0cHM6Ly93d3cudGhhd3RlLmNvbS9yZXBv SzBJMB8GCCsGAQUFBzABhhNodHRwOi8vdGouc3ltY2QuY29tMCYGCCsGAQUFBzAC B7MDaIXp7iniBRfFT3MOMm2Bs3Mju2Hwfhrgg7sf96iQzZkzAU6Mxdux -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf /qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/ LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7 jVaMaA== -----END CERTIFICATE-----

At the end, your abc.txt file will have something like this

-----BEGIN PRIVATE KEY----- MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDJl/Dwe2tzd5Z6 L4fWpUDVP6FDE9Tc0ViHlICsopxPumysltLwuLFCsc9gCOOURc6n0ej2XQoBJeue tqTIRZQ3VOlHqcmxdBTaAxw5iQ== -----END PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIIG5jCCBc6gAwIBAgIQUERflom9AJ4ssjDKLPM3SDANBgkqhkiG9w0BAQsFADBB bS9jcHMwLwYIKwYBBQUHAgIwIwwhaHR0cHM6Ly93d3cudGhhd3RlLmNvbS9yZXBv SzBJMB8GCCsGAQUFBzABhhNodHRwOi8vdGouc3ltY2QuY29tMCYGCCsGAQUFBzAC B7MDaIXp7iniBRfFT3MOMm2Bs3Mju2Hwfhrgg7sf96iQzZkzAU6Mxdux -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- MIIG5jCCBc6gAwIBAgIQUERflom9AJ4ssjDKLPM3SDANBgkqhkiG9w0BAQsFADBB bS9jcHMwLwYIKwYBBQUHAgIwIwwhaHR0cHM6Ly93d3cudGhhd3RlLmNvbS9yZXBv SzBJMB8GCCsGAQUFBzABhhNodHRwOi8vdGouc3ltY2QuY29tMCYGCCsGAQUFBzAC B7MDaIXp7iniBRfFT3MOMm2Bs3Mju2Hwfhrgg7sf96iQzZkzAU6Mxdux -----END CERTIFICATE----- -----BEGIN CERTIFICATE----- MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf /qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/ LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7 jVaMaA== -----END CERTIFICATE-----

Download OpenSSL from here Ones installed copy the abc.txt and paste it in the bin path of OpenSSL (e.g. C:\OpenSSL\bin)

Open the CMD, change directory to the bin folder of OpenSSL and paste the below command in CMD

openssl pkcs12 -export -in abc.txt -out xyz.pfx

give any password

You can use the xyz.pfx to import on IIS by using the same set of password




回答2:


You can do this with just built-in tool certutil.exe which is shipped with every Windows installation.

  1. make sure SSL certificate file and private key file are stored in the same folder and have same name: mycert.cer and mycert.key, for example. Certificate will have .cer file extension, key file will have .key file extension.
  2. run the following command: certutil -mergepfx path\mycert.cer path\mycert.pfx

this command will merge SSL certificate and private key into PFX container. Enter password when prompted.



来源:https://stackoverflow.com/questions/46701821/how-to-install-a-ssl-sertificate-from-diffrent-server-to-my-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!