Use OpenSSL commands to convert SSL certificate formats (Certificates Formats)

888u

Last update at :2024-07-07,Edit by888u

Whether we purchase the SSL certificate from a merchant or obtain it for free, if we need to deploy it to the panel or server WEB environment, the corresponding format requirements may be different. For example, when a netizen deploys an SSL certificate on Momen Cloud CDN, because it can only support certificates in PEM format, it is necessary to convert the original certificate into a different format.

There are many ways to convert formats. The simplest and most direct way is to use the OpenSSL software that comes with Linux to directly convert. The organizer is going to record the commonly used format conversion (Certificates Formats) methods through this article.

Before we prepare to convert the format, we need to find a Linux VPS with OpenSSL software already installed. If it is not installed, we can install it ourselves.

First, PEM to PKCS7

openssl crl2pkcs7 -nocrl -certfile your_pem_certificate.crt -out your_pkcs7_certificate.p7b

Second, PKCS7 to PEM

openssl pkcs7 -print_certs -in your_pkcs7_certificate.p7b -out your_pem_certificates.pem

Third, PEM to PFX

openssl pkcs12 -export -out your_pfx_certificate.pfx -inkey laozuo.key -in laozuo.crt

You need to set a password for PFX twice. The password needs to be remembered and you need to enter it when you import it back to the project.

Fourth, PFX to PEM

openssl pkcs12 -in your_pfx_certificate.pfx -out your_pem_certificates_and_key.pem -nodes

We need to be prompted to enter the password of the PFX certificate before we can transfer.

Fifth, PKCS7 to PFX

PKCS7 cannot be directly converted to PFX. We need to use the above method to first convert PKCS7 to PEM, and then convert PEM to PFX.

openssl pkcs7 -print_certs -in your_pkcs7_certificate.p7b -out your_pem_certificates.pem

openssl pkcs12 -export -out your_pfx_certificate.pfx -inkey your_private.key -in your_pem_certificate.crt

To summarize, when converting the SSL certificate format, we need to throw the certificate format into the current directory where the openssl conversion command is executed, and the file name needs to correspond.

Recommended site search: java host, Guangzhou server hosting, mobile proxy IP, host domain name, Korean virtual host, American PHP space, overseas server, Guangzhou website registration, Hong Kong high-defense server, proxy IP purchase website,

Use OpenSSL commands to convert SSL certificate formats (Certificates Formats)

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码