> ## Content Index
> Fetch the complete content index at: https://ostreff.info/llms.txt
> Use this file to discover other available public pages before exploring further.

# Conversion PFX to PEM certificate suitable for HAproxy
- URL: https://ostreff.info/conversion-pfx-to-pem-suitable-for-haproxy/
- Published: 2023-07-05T19:48:57.000Z
- Updated: 2023-07-05T21:44:54.000Z
- Author: Jordan Ostreff
- Tags: HAProxy

If you are maintaining such [haproxy](https://www.haproxy.org/?ref=ostreff.info) [ssl offloading](https://www.haproxy.com/blog/haproxy-ssl-termination?ref=ostreff.info), probably this quick'n'dirty script will be useful for you.

```
!#/bin/sh

openssl pkcs12 -in $1.pfx -out $1_nokey.pem -nokeys && \
openssl pkcs12 -in $1.pfx -out $1_withkey.pem && \
openssl rsa -in $1_withkey.pem -out $1.key && \
cat $1_nokey.pem $1.key > $1.pem
```