# Certificat



# Create CSR CERTIFICATE OPENSSL

[![image.png](https://cavallone.fr/uploads/images/gallery/2024-10/scaled-1680-/5MKyUXm0g3UIj4xk-image.png)](https://cavallone.fr/uploads/images/gallery/2024-10/5MKyUXm0g3UIj4xk-image.png)

[![image.png](https://cavallone.fr/uploads/images/gallery/2024-10/scaled-1680-/ZROzgnV19vRwVOBy-image.png)](https://cavallone.fr/uploads/images/gallery/2024-10/ZROzgnV19vRwVOBy-image.png)

# Certificat PFX EXTRACTION

[![image.png](https://cavallone.fr/uploads/images/gallery/2024-10/scaled-1680-/sZxTBKhlBtHx1P2S-image.png)](https://cavallone.fr/uploads/images/gallery/2024-10/sZxTBKhlBtHx1P2S-image.png)

[![image.png](https://cavallone.fr/uploads/images/gallery/2024-10/scaled-1680-/RDxTZd5GaxQSxIz1-image.png)](https://cavallone.fr/uploads/images/gallery/2024-10/RDxTZd5GaxQSxIz1-image.png)

[![image.png](https://cavallone.fr/uploads/images/gallery/2024-10/scaled-1680-/WxotDGX3LytvMz7N-image.png)](https://cavallone.fr/uploads/images/gallery/2024-10/WxotDGX3LytvMz7N-image.png)

# script extract certificat.pfx

```bash
#!/bin/bash

# mettre son fichier pfx
read -p "Entre le chemin de ton fichier PFX : " pfx_file

if [ -f "$pfx_file" ]; then
  echo "le fichier pfx na pas été trouver"
  exit 1
fi

# mettre le nom du certificat a extraire
read -p "Entre le nom du certificat : " cert_name

# extrait la clé privée
openssl pkcs12 in "$pfx_file" -nocerts -out "${cert_name}-encrypted.key"
openssl rsa in "${cert_name}-encrypted.key" -out "${cert_name}.key"

# extrait le certificat
openssl pkcs12 in "$pfx_file" clcerts nokeys out "${cert_name}.crt"

# extrait le CA
openssl pkcs12 in "$pfx_file" -nokeys nodes cacerts -out "${cert_name}-ca.crt"
```