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.



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.

2 Responses to Convert your P7B Certificate to PFX
  1. Hi – I’m trying to convert p7b to pfx for my RDS (IIS) server, but I’m getting this error Can’t open private.key for reading, No such file or directory
    22296:error:02001002:system library:fopen:No such file or directory:crypto\bio\bss_file.c:69:fopen(‘private.key’,’r’)
    22296:error:2006D080:BIO routines:BIO_new_file:no such file:crypto\bio\bss_file.c:76:
    unable to load private key

    Where can I find the private key so I can complete this step?

    • Hi,
      If you know the key name is private.key you can find the location with “locate private.key” command. If you don’t have locate installed, install with “yum install mlocate;updatedb”


Leave a Reply

Your email address will not be published.