#!/bin/bash
[ ! -d splitted ] && mkdir splitted
while read domain
do
fqdn=$(echo $domain | tr '\n' ' ' | awk '{print $1}')
cert=$(echo $domain | awk '{print $2}' | base64 --decode )
key=$(echo $domain | awk '{print $3}' | base64 --decode )
echo $fqdn
cat > splitted/$fqdn.crt << EOF
$cert
EOF
cat > splitted/$fqdn.key << EOF
$key
EOF
openssl x509 -in splitted/$fqdn.crt -noout -text || less splitted/$fqdn.crt
done < <(cat acme.json | jq '.le.Certificates[]| "\(.domain.main) \(.certificate) \(.key)"' | sed 's/"//')
test
openssl s_client -showcerts -connect example.com:443
https://gchq.github.io/CyberChef/#recipe=Parse_X.509_certificate('PEM')