(DC) Certificate Format Conversion

(DC) Certificate Format Conversion

Description

This document discusses the use of many different tools to get a certificate into a specific format that is required for a service to import it.  There are request, import, and archival formats that can be used.

Certificate Format Reference

Format

File Extension

Notes

Format

File Extension

Notes

PEM

.pem, .crt, .cer, and .key

The PEM format is the most common format that Certificate Authorities utilize to issue certificates.  They are Base64 encoded ASCII files and contain "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" statements. Server certificates, intermediate certificates, and private keys can all be put into the PEM format.  Several PEM certificates, and even the private key, can be included in one file, one below the other, but most platforms, such as Apache, expect the certificates and private key to be in separate files.

Used by: Apache and similar Unix based systems/applications.

DER

.der, .cer

The DER format is simply a binary form of a certificate instead of the ASCII PEM format.  All types of certificates and private keys can be encoded in DER format. 

Used by: Java platforms

PKCS#7
P7B

.p7b or .p7c.

This is usally a Base64 based ASCII format, that like PEM, contain "-----BEGIN PKCS7-----" and "-----END PKCS7-----" statements.  Can contain certificates and chain certificates but not private keys.

Used by: Microsoft Windows and Java Tomcat.

PKCS#12
PFX

.pfx, .p12

This, like DER, is a binary format for storing the server and any intermediate certificates, and the private key in one encrypted file.   The format is typically used on Windows machines to import and export certificates and private keys.

Used by:  Windows OS workstations and servers.

Certificate Conversion Tools

 

 

 

 

ONLINE: SSL Shopper SSL Certificate Converter
SSL Converter - Convert SSL Certificates to different formats

image-20250217-222044.png

ONLINE: LeaderSSL Certificate Converter
SSL Converter | LeaderSSL

Local conversion with OpenSSL

Convert PEM to DER, P7B or PFX

Convert PEM to DER
openssl x509 -outform der -in certificate.pem -out certificate.der

 

Convert PEM to P7B
openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b -certfile CACert.ce

 

Convert PEM to PFX
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.cr

Convert DER to PEM

Convert DER to PEM
openssl x509 -inform der -in certificate.cer -out certificate.pem

Convert P7B to PEM or PFX

Convert P7B to PEM
openssl pkcs7 -print_certs -in certificate.p7b -out certificate.ce

 

Convert P7B to PFX
openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer openssl pkcs12 -export -in certificate.cer -inkey privateKey.key -out certificate.pfx -certfile CACert.ce

Convert PFX to PEM

Convert PFX to PEM
openssl pkcs12 -in certificate.pfx -out certificate.cer -nodes