Last active
September 22, 2016 16:38
-
-
Save afresh1/35175ddfec561506200e810ba2cb7ed6 to your computer and use it in GitHub Desktop.
This script replaces the c_rehash perl script from openssl, at least the main functionality of it. From http://man.openbsd.org/SSL_CTX_load_verify_locations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# replaces the c_rehash perl script from openssl. | |
# by afresh1 | |
rm -f *.[0-9]* *.r[0-9]* | |
for c in *.pem; do | |
[ "$c" = "*.pem" ] && continue | |
hash=$(openssl x509 -noout -hash -in "$c") | |
if egrep -q -- '-BEGIN( X509 | TRUSTED | )CERTIFICATE-' "$c"; then | |
suf=0 | |
while [ -e $hash.$suf ]; do suf=$(( $suf + 1 )); done | |
ln -s "$c" $hash.$suf | |
fi | |
if egrep -q -- '-BEGIN X509 CRL-' "$c"; then | |
suf=0 | |
while [ -e $hash.r$suf ]; do suf=$(( $suf + 1 )); done | |
ln -s "$c" $hash.r$suf | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment