If you are using third-party certificate files, ensure that the files are in .pem format. If not, follow the information in this section to convert them.
Convert RSA Key File to PEM Format
Use the following command to convert an RSA key file to a .pem format file:
Syntax:
openssl rsa -in <path-to-key-file> -text <path-to-PEM-file>
Example:
openssl rsa -in C:\Certificates\serverKeyFile.key -text > serverKeyFileInPemFormat.pem
Convert CER File to PEM Format
Use the following command to view the .cer file:
Syntax:
openssl x509 -in <path-to-cer-file> -text -noout
Example:
openssl x509 -in C:\Certificates\AnyCert.cer -text -noout
If you receive the following error, it implies that it is a DER-encoded .cer file. Then, follow theConvert DER-Encoded .cer Filesection to convert a DER-encoded .cer file:
unable to load certificate 12626:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:647:Expecting: TRUSTED CERTIFICATE
Convert DER-Encoded CER File
Use the following commands to convert a DER-encoded .cer file to a .pem format:
Syntax:
openssl x509 -inform DER -in <path-to-cer-file> -out <path-to-crt-file> openssl x509 -in <path-to-crt-file> -out <path-to-pem-file> -outform PEM
Example:
openssl x509 -inform DER -in C:\Certificates\AnyCert.cer -out C:\Certificates\AnyCertCrt.crt openssl x509 -in C:\Certificates\AnyCertCrt.crt -out C:\Certificates\AnyCertInPem.pem -outform PEM
Convert a base64-Encoded CER File
Use the following command to convert a base64-encoded .cer file to a .pem format file:
Syntax:
openssl x509 -in <path-to-cer-file> -outform pem -out <path-to-pem-file>
Example:
openssl x509 -in C:\Certificates\AnyCert.cer -outform pem -out C:\Certificates\AnyCertInPem.pem