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

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

    Additionally, if you don't want it to ask for a passphrase, then need to run the following command:

    openssl rsa -in server.key -out server.key
    
    0 讨论(0)
  • 2020-11-22 10:49

    this is the best option to create .pem file

    openssl pkcs12 -in MyPushApp.p12 -out MyPushApp.pem -nodes -clcerts
    
    0 讨论(0)
  • 2020-11-22 10:52

    Your keys may already be in PEM format, but just named with .crt or .key.

    If the file's content begins with -----BEGIN and you can read it in a text editor:

    The file uses base64, which is readable in ASCII, not binary format. The certificate is already in PEM format. Just change the extension to .pem.

    If the file is in binary:

    For the server.crt, you would use

    openssl x509 -inform DER -outform PEM -in server.crt -out server.crt.pem
    

    For server.key, use openssl rsa in place of openssl x509.

    The server.key is likely your private key, and the .crt file is the returned, signed, x509 certificate.

    If this is for a Web server and you cannot specify loading a separate private and public key:

    You may need to concatenate the two files. For this use:

    cat server.crt server.key > server.includesprivatekey.pem
    

    I would recommend naming files with "includesprivatekey" to help you manage the permissions you keep with this file.

    0 讨论(0)
  • 2020-11-22 10:53
    1. Download certificate from provisional portal by appleId,
    2. Export certificate  from Key chain and  give name (Certificates.p12),
    3. Open terminal and goto folder where you save above Certificates.p12 file,
    4. Run below commands:

      a) openssl pkcs12 -in Certificates.p12 -out CertificateName.pem -nodes,

      b) openssl pkcs12 -in Certificates.p12 -out pushcert.pem -nodes -clcerts

    5. Your .pem file ready "pushcert.pem".
    0 讨论(0)
提交回复
热议问题