# Compiling .pfx file using openssl

A **.pfx** file, also known as **PKCS #12** or **P12** file, is a binary format for storing cryptographic objects. It typically contains:

1. **Private Key** (`.key` file)
2. **Public Key Certificate** (`.crt` file)
3. **CA Certificate Chain** (optional)

The `.pfx` file is commonly used to import and export certificates along with their private keys. It is often required when configuring SSL/TLS for web servers, email clients, or cloud services like Azure or AWS.

***



### Generating .pfx file

Note :  You should have the Private Key (.key) file & the CA cert (root.crt) to make the pfx file and the CA-chain(.bundle) if available by the Domain Holder

```
# openssl pkcs12 -export -out ghoulsec.pfx -inkey ghoulsec.key -in ghoulsec.crt
```

* Verifying .pfx file&#x20;

<pre><code># openssl pkcs12 -info -in ghoulsec.pfx
<strong> -  Enter the passphrase : Admin@123(&#x3C;defpass>)
</strong> :
 - &#x3C; EOL > OK 
</code></pre>

