Created
November 17, 2015 19:13
-
-
Save mjdetullio/592239b0fe3988a7e6ad to your computer and use it in GitHub Desktop.
OS X: Verify all certificates in a keychain
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/bash -xe | |
KEYCHAIN="~/Library/Keychains/login.keychain" | |
TMPFILE="$(mktemp)" | |
security find-certificate -a "${KEYCHAIN}" | grep '"alis"<blob>=' | sed -e 's/^ "alis"<blob>="\(.*\)"$/\1/' | while read -r CERT_NAME | |
do | |
security find-certificate -c "${CERT_NAME}" -p "${KEYCHAIN}" > "${TMPFILE}" | |
security verify-cert -c "${TMPFILE}" -k "${KEYCHAIN}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It gives no output if I run the above shell script, could you please help me to make it work.
I tried echo ${TMPFILE} and got "var/folders/vq/wfgn1p4j74v467wr8dmgt33r0000gq/T/tmp.mkmje0UQ" path
When I did cd to above path
tmp.mkmje0UQ
give me nothing (an empty file)