English
Frequently Asked Questions

How to convert the certificate format?

Updated Time:2022-03-09  Views:40309

Different web servers support different certificate formats. You need to convert the issued certificate into a format suitable for the current web server in order to install the SSL certificate normally. This article describes how to convert the certificate format.
You can refer to the following methods to convert between certificate formats:
* Convert JKS format certificate to PFX format
You can use the built-in Keytool tool in the JDK to convert the JKS format certificate file into the PFX format. For example, you can execute the following command to convert the cert_name.jks certificate file into a cert_name.pfx certificate file:

keytool -importkeystore -srckeystore D:\<cert_name>.jks -destkeystore D:\<cert_name>.pfx -srcstoretype JKS -deststoretype PKCS12

illustrate:
The certificate name in this article takes cert_name as an example. For example, the certificate file name is cert_name.pem, and the certificate key file name is cert_name.key. You need to replace cert_name with your certificate name in actual use.
The Keytool tool is a key management tool that comes with the JDK. It can create a certificate file in Keystore (jks) format. You can download the JDK toolkit from the official address to obtain the Keytool tool. The tool is generally located in the JDK\jre\bin\security\ directory.

* Convert PFX format certificate to JKS format
You can use the built-in Keytool tool in the JDK to convert the certificate file in PFX format to JKS format. For example, you can execute the following command to convert the cert_name.pfx certificate file to the cert_name.jks certificate file:

keytool -importkeystore -srckeystore D:\<cert_name>.pfx -destkeystore D:\<cert_name>.jks -srcstoretype PKCS12 -deststoretype JKS

* Convert PEM/KEY/CRT format certificate to PFX format
You can use the OpenSSL tool to convert KEY format key files, PEM or CRT format public key files into PFX format certificate files. For example, copy your KEY format key file cert_name.key and PEM format public key file cert_name.pem to the OpenSSL tool installation directory, and use the OpenSSL tool to execute the following command to convert the certificate into the cert_name.jks certificate file:

openssl pkcs12 -export -out <cert_name>.pfx -inkey <cert_name>.key -in <cert_name>.pem

* Convert PFX to PEM/KEY/CRT
You can use the OpenSSL tool to convert PFX format certificate files into KEY format key files, PEM or CRT format public key files. For example, copy your PFX format certificate file cert_name.jks to the OpenSSL installation directory, and use the OpenSSL tool to execute the following commands to convert the certificate into a cert_name.pem certificate file and a KEY format key file cert_name.key:

openssl pkcs12 -in <cert_name>.pfx -nokeys -out <cert_name>.pem openssl pkcs12 -in <cert_name>.pfx -nocerts -out <cert_name>.key -nodes

 

Copyright© 2024 DIJIAG.COM. All rights reserved.