How to get .pem file from .key and .crt files?

后端 未结 10 2006
-上瘾入骨i
-上瘾入骨i 2020-11-22 10:06

How can I create a PEM file from an SSL certificate?

These are the files that I have available:

  • .crt
  • server.csr
10条回答
  •  误落风尘
    2020-11-22 10:41

    I needed to do this for an AWS ELB. After getting beaten up by the dialog many times, finally this is what worked for me:

    openssl rsa -in server.key -text > private.pem
    openssl x509 -inform PEM -in server.crt > public.pem
    

    Thanks NCZ

    Edit: As @floatingrock says

    With AWS, don't forget to prepend the filename with file://. So it'll look like:

     aws iam upload-server-certificate --server-certificate-name blah --certificate-body file://path/to/server.crt --private-key file://path/to/private.key --path /cloudfront/static/
    

    http://docs.aws.amazon.com/cli/latest/reference/iam/upload-server-certificate.html

提交回复
热议问题