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

后端 未结 10 2002
-上瘾入骨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:32

    I was trying to go from godaddy to app engine. What did the trick was using this line:

    openssl req -new -newkey rsa:2048 -nodes -keyout name.unencrypted.priv.key -out name.csr
    

    Exactly as is, but replacing name with my domain name (not that it really even mattered)

    And I answered all the questions pertaining to common name / organization as www.name.com

    Then I opened the csr, copied it, pasted it in go daddy, then downloaded it, unzipped it, navigated to the unzipped folder with the terminal and entered:

    cat otherfilegodaddygivesyou.crt gd_bundle-g2-g1.crt > name.crt
    

    Then I used these instructions from Trouble with Google Apps Custom Domain SSL, which were:

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

    exactly as is, except instead of privateKey.key I used name.unencrypted.priv.key, and instead of www_mydomain_com.crt, I used name.crt

    Then I uploaded the public.pem to the admin console for the "PEM encoded X.509 certificate", and uploaded the private.pem for the "Unencrypted PEM encoded RSA private key"..

    .. And that finally worked.

提交回复
热议问题