I have a .pem file with SSL private key and certificate chain for my web-server concatenated into a single file. The file is in following structure:
-----BEGIN PRIVATE KEY-----
...data...
-----END PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
...data...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
...data...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
...data...
-----END CERTIFICATE-----
What commands I use to split it to have separate files private.key
and fullchain.pem
?
Assuming the input file
your-file.pem
contains only 1 private key and corresponding chain of certificates.Extract private key:
Extract fullchain certificates:
If the certificate data comes from standard input, use
/dev/stdin
: