简体   繁体   中英

Convert root certificate ,server certificate and intermediate certificate to .cert and .key file

I have three certificate files rootcertificate.txt, intermediateCertificate.txt, and serverCertificate.txt. I want to install an SSL certificate on the Nginx server in the ubuntu platform and for this required two files yourdomain.cert and yourdomain.key

So my question is how to convert three files into.cert and.key format

You need to build a certificate bundle (certificate chain). To do so, you just have to concatenate your three certificates. Make sure to have the Root CA on top of your chain, instead it won't work.

cat rootcertificate.txt  intermediateCertificate.txt \
serverCertificate.txt  > fullchain.txt

If your certificate are in DER format and you want to convert them in PEM before building your chain. You can use the ssl command below to convert your certificate in PEM.

openssl x509 -in serverCertificate.txt -out serverCertificate.pem \ 
-inform DER -outform PEM

You can use the same conversion to convert your private key in PEM also. Make sure to change in the "inform" in your certificate format they are not DER. Default value is PEM format.

No you can't, as I understand all you have are certificates

  • rootcertificate.txt is root CA certificate
  • intermediateCertificate.txt is Intermediate CA certificate, created by root CA
  • serverCertificate.txt is your server certificate, created by Intermediate CA certificate

for yourdomain.cert , you just need to rename serverCertificate.txt into yourdomain.cert

for yourdomain.key , it's not possible, you need to request the person who give you certificates for the private key

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM