# Cannot export or import the certificate with its private key (PFX/PKCS#12 has no private key)

**Code:** `PFX export` · **Category:** SSL / TLS · **Seen on:** Windows, OpenSSL, SSL

The `.pfx` file contains only the certificate, so servers that need the private key fail.

## Meaning

The key lives on the machine that generated the CSR. Export from that machine with "Yes, export the private key", or combine the CA-issued certificate with the original key (`openssl pkcs12 -export -inkey private.key -in cert.pem -certfile chain.pem -out site.pfx`). If the key is lost, reissue with a new CSR. On Windows, run `certutil -repairstore my THUMBPRINT` to relink.

## Common causes

- Certificate imported without the CSR machine's key
- Exported without the private key option
- Key marked non-exportable
- Key lost or generated elsewhere
- Wrong store/user context

## Quick fix

1. Export from the CSR machine including the key
2. Build the PFX with `openssl pkcs12 -export -inkey`
3. Reissue with a new CSR if the key is lost

## Detailed fix by platform

### Shell

1. 

```bash
openssl pkcs12 -export -inkey private.key -in cert.pem -certfile chain.pem -out site.pfx
certutil -repairstore my THUMBPRINT
```


## How to diagnose

1. **Key** — Available?
2. **Export option** — Enabled?
3. **Store** — Correct?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ssl/pfx-export-missing-private-key)
