PFX and P12 Converter
Operator: Abdulla Al Fahad. How tools are built and checked
Moving a certificate from IIS to nginx, or from a Java keystore to a cloud load balancer, comes down to converting a .pfx into PEM files or the reverse. The common way is an online converter that asks you to upload the private key. This page does the decryption in the tab, so the key and its password never leave it.
It opens PKCS#12 files with a password, verifies the integrity MAC, lists the certificates and keys, checks that the key belongs to the certificate, and then exports PEM or builds a new PFX.
Key features
- Reads modern PBES2 files (AES with PBKDF2) and legacy ones: 3DES, and RC2-40 using a built-in RC2 because WebCrypto has none
- Verifies the MAC and says which hash and how many iterations it used
- Lists certificates with subject, issuer, validity, SANs and fingerprints, marks leaf, chain and root, and shows the key type, size or curve
- Confirms the private key matches a certificate by comparing public keys
- Exports certificates, the chain, and the key as encrypted PKCS#8, unencrypted PKCS#8 or unencrypted RSA PKCS#1
- Builds a PFX from PEM certificate, chain and key, with AES-256 and PBKDF2 or legacy 3DES for old Windows and Java
Which encryption schemes are read and written
A PKCS#12 file is a PFX wrapper with a MAC over its contents, holding safe bags: certificate bags and key bags, each possibly encrypted. OpenSSL 3 writes PBES2 with AES-256-CBC and PBKDF2-HMAC-SHA256 by default, and older tools write pbeWithSHAAnd3-KeyTripleDES-CBC for keys and RC2-40 for certificates, with an HMAC-SHA1 MAC. Writing offers two modes. Modern uses AES-256-CBC with PBKDF2-HMAC-SHA256 at 100,000 iterations and an HMAC-SHA256 MAC at 10,000. Legacy uses 3DES-CBC with 2,048 iterations and HMAC-SHA1, which is what older Windows versions and old Java keystores expect.
Files up to 20 MB are read. PBKDF2 iteration counts above 1,000,000 are refused, and one file may spend at most 10 million key-derivation iterations in total across its MAC and encrypted bags (a few seconds to about ten), so a crafted file with thousands of bags cannot stall the tab. ASN.1 nesting and element counts are capped.
How it works
Key derivation uses WebCrypto for PBKDF2 and AES and the page's own code for the PKCS#12 key derivation function, 3DES and RC2. The MAC is checked first; a wrong password and a damaged file both fail it, and the message says so. When building, the certificate and key are parsed first, and the key must match the leaf certificate or the page stops with the reason.
Common use cases
- A sysadmin gets a legacy .pfx from a Windows server with an RC2-40 certificate bag. OpenSSL 3 needs the -legacy flag for it; this page opens it directly and exports server.crt and an encrypted key for nginx.
- A developer builds a PFX for a Java 8 keystore in legacy mode, because 3DES with HMAC-SHA1 is what the old runtime reads.
How to use this tool
- Drop a .pfx or .p12 file and type its password, or choose Load example to generate a throwaway identity.
- Check the MAC line, the certificate list and the key match.
- Pick an export: certificates and chain as PEM, and the key as encrypted or unencrypted.
- To build one, open the PEM tab, paste or drop the certificate, chain and key, set a password and choose the mode.
Example
Load example, then build a PFX from it with the password S3cret! in modern mode
One P-256 certificate, CN=sample.example.test (test certificate), and its private key as PEMSummary shown after the build
Download offered as sample.pfx
Certificates and key encrypted with AES-256-CBC, PBKDF2-HMAC-SHA256, 100,000 iterations
MAC: HMAC-SHA256, 10,000 iterations
1 certificate(s) and 1 private keyEdge cases to watch
An empty password produces a warning, because Windows and Java importers refuse or mishandle it.
A PFX can hold several keys and certificates. The key match is checked per certificate, and each certificate without a matching key is labelled Intermediate CA, Root or self-issued, or Other certificate.
Unencrypted key files give whoever holds them the identity of the certificate. A download needs a tick on a confirmation first.
- A PFX from OpenSSL 3 opens in current Windows and Java; choose legacy only for systems that fail to import the modern one.
- The key download offers encrypted PKCS#8 first. Choose an unencrypted format only when the target server cannot take a password.
Common errors and how to fix them
- MAC mismatch
- The password is wrong or the file was altered. Retype it carefully. Legacy files derive their keys from the password as UTF-16 text and PBES2 files as UTF-8, which is what OpenSSL does, so a non-ASCII password needs no special handling here.
- "The private key does not match any of the certificates"
- The key and certificate come from different requests. Use the key that was generated with the CSR for this certificate.
Best practices
- Check the new file with openssl pkcs12 -info -in file.pfx on the target system before deploying it.
Reading certificate details
Subject, issuer, validity, subject alternative names and SHA-1 and SHA-256 fingerprints are shown for every certificate, with the same fields the SSL certificate decoder shows. That decoder takes a single certificate as PEM text; this page opens the PKCS#12 container, decrypts it with the password and shows every certificate and key inside. The leaf is the one whose public key matches a private key in the file.
Frequently asked questions
Does the page contact a server to check the certificate?
No. Revocation and chain trust are not checked; it reads what the file contains.
Should I generate a CSR here?
No, the CSR generator on this site does that. Bring the certificate and key from it back here to bundle them.