How to convert .pem to .pfx

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

How to convert .pem to .pfx

Postby Ardito » 10 Mar 2022, 21:55

Hi, I bought an ssl certificate, I received a .pem file of my third level domain, inside this file I have 3 BEGIN / END blocks.
I am following the official SFS2X guide: http://docs2x.smartfoxserver.com/GettingStarted/cryptography
I am using OpenSSL version 3.0.1 (Windows)

I have to use this command:

Code: Select all

openssl pkcs12 -export -out my-cert.pfx -inkey www.mydomain.com.key -in www.mydomain.com.crt -certfile bundle.crt


I got the .crt file by using this command:

Code: Select all

openssl x509 -outform der -in my-cert.pem -out certfileOutName.crt


But I haven't received any .key file, maybe this file is inside the .pem file?
I've tried a lot of commands to extract the .key private key, but none seem to work.
Can I do all this procedure on any pc and then upload the files to the server, or do I have to do everything on the target machine?
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: How to convert .pem to .pfx

Postby Ardito » 11 Mar 2022, 10:14

UPDATES:
I made the request for the private key to the site where I bought the certificate, and they sent it to me in .TXT UTF-8.
I opened it and saved it in .KEY format.

I try to use the code:

Code: Select all

openssl pkcs12 -export -out my-cert.pfx -inkey www.mydomain.com.key -in www.miodominio.com.crt -certfile bundle.crt


But I get these errors:

Code: Select all

34420000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:crypto\store\store_register.c:237:scheme=file
34420000:error:80000002:system library:file_open:No such file or directory:providers\implementations\storemgmt\file_store.c:269:calling stat(D:\PATH\XXX.MyDomain_FAKE.it.key)
34420000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:crypto\store\store_register.c:237:scheme=D
34420000:error:1608010C:STORE routines:inner_loader_fetch:unsupported:crypto\store\store_meth.c:357:No store loader found. For standard store loaders you need at least one of the default or base providers available. Did you forget to load them? Info: Global default library context, Scheme (D : 0), Properties (<null>)
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: How to convert .pem to .pfx

Postby Ardito » 12 Mar 2022, 00:36

I solved it by contacting the support of whoever sold me the certificate

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Baidu [Spider] and 149 guests