objectif
Rendre utilisables des certificats fournis en .p12 dans des logiciels nécessitant des PEM séparés.
code minimal
# extraire clé (protégée par passphrase)
openssl pkcs12 -in bundle.p12 -nocerts -nodes -out key.pem
# extraire cert + chaîne
openssl pkcs12 -in bundle.p12 -clcerts -nokeys -out cert.pem
openssl pkcs12 -in bundle.p12 -cacerts -nokeys -out chain.pem
utilisation
# vérifier
openssl x509 -in cert.pem -noout -subject -issuer -dates
variante(s) utile(s)
# regrouper cert + chaîne
cat cert.pem chain.pem > fullchain.pem
notes
- protégez
key.pem(chmod 600) et stockez-le en sécurité. - certains p12 n’ont pas de chaîne complète: complétez si nécessaire.