Skip to content

Instantly share code, notes, and snippets.

@ozeias
Created November 14, 2012 14:23
Show Gist options
  • Save ozeias/4072382 to your computer and use it in GitHub Desktop.
Save ozeias/4072382 to your computer and use it in GitHub Desktop.
Converting SSL-certificates from CRT format to PEM
#/bin/bash
for f in $(file *.crt|grep data|sed 's/: *data//')
do
echo "Processing $f file to ${f/.crt/.pem}..."
openssl x509 -in $f -inform der -outform pem -out ${f/.crt/.pem}
rm $f
done
# openssl x509 -in serprov2.crt -out serprov2.der -outform DER
# openssl x509 -in serprov2.der -inform der -outform pem -out serprov2.pem
for f in *.crt
do
echo "Processing $f file to ${f/.crt/.pem}..."
openssl x509 -in $f -out ${f/.crt/.der} -outform DER
openssl x509 -in ${f/.crt/.der} -inform der -outform pem -out ${f/.crt/.pem}
rm $f
rm ${f/.crt/.der}
done
# Find broken symlinks and delete them
# find -L . -type l -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment