Original Script
#!/bin/sh
# Friendly Name
openssl x509 -in $1 -text -noout | sed -n -e '/^[ ]+Subject:/{s/^.*CN=([^,]*\).*/\1/;p\}'
# Underline Friendly Name with equal signs
openssl x509 -in $1 -text -noout | sed -n -e '/^[ ]+Subject:/{s/^.*CN=([^,]*\).*/\1/;p\}' | sed -e 's/./=/g'
# Output Fingerprint and swap = for :
openssl x509 -in $1 -noout -fingerprint | sed -e 's/=/: /'
# Output PEM Data:
echo 'PEM Data:'
# Output Certificate
openssl x509 -in $1
# Output Cettificate text swapping Certificate with Certificate Ingredients
openssl x509 -in $1 -text -noout | sed -e 's/^Certificate:/Certificate Ingredients:/'
Script modified by Komar for BSD sed
#!/bin/sh
#
# Convert PEM Certificate to ca-bundle.crt format
#
# Now this work with *BSD sed as well. fix by komar
test ! $1 && printf "Usage: `basename $0` certificate" && exit 1
# Friendly Name and Underline Friendly Name with equal signs
openssl x509 -in $1 -text -noout | sed -e 's/^ *Subject:.*CN=\([^,]*\).*/\1/p;t c' -e 'd;:c' -e 's/./=/g'
# Output Fingerprint and swap = for :
openssl x509 -in $1 -noout -fingerprint | sed -e 's/=/: /'
# Output PEM Data:
echo 'PEM Data:'
# Output Certificate
openssl x509 -in $1
# Output Cettificate text swapping Certificate with Certificate Ingredients
openssl x509 -in $1 -text -noout | sed -e 's/^Certificate:/Certificate Ingredients:/'