concatenated PEM file: split private key and certificate chain

Solution 1:

Assuming the input file your-file.pem contains only 1 private key and corresponding chain of certificates.

Extract private key:

openssl storeutl -keys your-file.pem > private.key

Extract fullchain certificates:

openssl storeutl -certs your-file.pem > fullchain.pem

If the certificate data comes from standard input, use /dev/stdin :

cat your-file.pem | openssl storeutl -keys /dev/stdin
cat your-file.pem | openssl storeutl -certs /dev/stdin