Created
February 25, 2014 16:07
-
-
Save ggrandes/9211933 to your computer and use it in GitHub Desktop.
OpenSSL X.509 Certificate Linking / Verify
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 | |
# | |
# usage: certlink.sh filename [filename ...] | |
# | |
# This create links like: | |
# 2c543cd1.0 -> GeoTrustGlobalCA.crt | |
# | |
# Source: www.madboa.com/geek/openssl/ | |
# License: creativecommons.org/licenses/by-nc-sa/3.0/ | |
# | |
for CERTFILE in $*; do | |
# make sure file exists and is a valid cert | |
test -f "$CERTFILE" || continue | |
HASH=$(openssl x509 -noout -hash -in "$CERTFILE") | |
test -n "$HASH" || continue | |
# use lowest available iterator for symlink | |
for ITER in 0 1 2 3 4 5 6 7 8 9; do | |
test -f "${HASH}.${ITER}" && continue | |
ln -s "$CERTFILE" "${HASH}.${ITER}" | |
test -L "${HASH}.${ITER}" && break | |
done | |
done |
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 | |
# | |
# usage: verify.sh filename [filename ...] | |
# | |
openssl verify -CApath /etc/ssl/certs/ $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment