TL;DR
Yes, you can convert a .DER file (digital certificate) to a .PFX or .P12 file (PKCS#12 format, which includes the private key). You’ll need OpenSSL. This guide shows how.
Converting DER to PFX/P12
- Check you have OpenSSL installed.
- On Linux/macOS, open a terminal and type
openssl version. If it’s not found, install it (e.g.,sudo apt-get install opensslon Debian/Ubuntu orbrew install opensslon macOS). - On Windows, download OpenSSL from a reputable source (like slpsecretkey) and add its ‘bin’ directory to your system PATH environment variable. Then open a new command prompt and type
openssl version. - Obtain the Private Key. A .PFX/.P12 file *must* contain both the certificate (.DER) and its corresponding private key. If you don’t have the private key, you can’t create a PFX/P12.
- If your private key is in PEM format (starts with
-----BEGIN PRIVATE KEY-----), skip to step 3. - If your private key is in another format, convert it to PEM first using OpenSSL. For example, if it’s encrypted:
openssl rsa -in encrypted_key.der -out unencrypted_key.pem. You will be prompted for the passphrase.
- If your private key is in PEM format (starts with
- Create a PKCS#12 file (.PFX/.P12) using OpenSSL. This combines the certificate and private key.
Use the following command:
openssl pkcs12 -export -out output.pfx -inkey unencrypted_key.pem -in certificate.der -certfile certificate.der- output.pfx: The name of the file you want to create (you can use .p12 instead of .pfx).
- unencrypted_key.pem: Your private key in PEM format.
- certificate.der: Your certificate in DER format. You need to specify this twice, as some systems require it for the chain.
You will be prompted for an export password. Remember this password! You’ll need it when importing the .PFX/.P12 file.
- (Optional) Add a Password to the PFX/P12 File (if not already done). The previous step prompts for a password during creation. If you skipped that, or want to change it:
openssl pkcs12 -export -out output.pfx -inkey unencrypted_key.pem -in certificate.der -certfile certificate.der -passout pass:newpassword- Replace
newpasswordwith your desired password.
- Replace
- Verify the PFX/P12 file. You can import it into a key store (e.g., Java KeyStore, Windows Certificate Store) to check if it works correctly.
Important Security Note: Keep your private key secure! Do not share it with anyone. Use strong passwords for both the private key and the PFX/P12 file.

