When i try to convert my certificates to pfx format, i encountered a problem shown below

# openssl pkcs7 -print_certs -in PKCS7.p7b -out certificate.cer

unable to load PKCS7 object
140083803338568:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: PKCS7

To solve this issue:

1) Copy your PKCS7.p7b file as PKCS7.crt

2) Open this file with your editor and add these lines.

—–BEGIN CERTIFICATE—–

—–END CERTIFICATE—–

3) openssl pkcs7 -print_certs -in PKCS7.crt -out certificate.cer

4) openssl pkcs12 -export -in certificate.cer -inkey private.key -out PKCS7.pfx -certfile bundle.cer
Enter Export Password:
Verifying – Enter Export Password:

Voila! Your PFX file is ready.