Posted on 12-30-2015 10:34 AM
Anyone gotta quick and dirty way to collect a list of certificates from the System Keychain using a script / EA?
Solved! Go to Solution.
Posted on 12-30-2015 10:52 AM
Nothing complete unfortunately. The security command-line tool can be trickier than it first appears!
You can get the info with security find-certificate -a /Library/Keychains/System.keychain
but it will take a bit of cleaning up to make it useful.
Something like this seems to work: security find-certificate -a /Library/Keychains/System.keychain | grep "alis" | sed 's/"//g' | sed 's/ alis<blob>=//g'
Or in EA format:
certs=$(security find-certificate -a /Library/Keychains/System.keychain | grep "alis" | sed 's/"//g' | sed 's/ alis<blob>=//g')
echo "<result>$certs</result>"
Posted on 12-30-2015 10:52 AM
Nothing complete unfortunately. The security command-line tool can be trickier than it first appears!
You can get the info with security find-certificate -a /Library/Keychains/System.keychain
but it will take a bit of cleaning up to make it useful.
Something like this seems to work: security find-certificate -a /Library/Keychains/System.keychain | grep "alis" | sed 's/"//g' | sed 's/ alis<blob>=//g'
Or in EA format:
certs=$(security find-certificate -a /Library/Keychains/System.keychain | grep "alis" | sed 's/"//g' | sed 's/ alis<blob>=//g')
echo "<result>$certs</result>"
Posted on 01-03-2016 06:52 PM
Thanks David! Seems to do the trick!
Posted on 01-03-2016 09:02 PM
Slightly shorter way, but same principle:
security find-certificate -a /Library/Keychains/System.keychain | awk -F'"' '/alis/{print $4}'
Posted on 11-02-2017 01:15 PM
@davidacland David hey i am no script writer by any means and i am trying to take the EA you provided which worked by the way to see if i can get a specific profile instead a list of every one. Also maybe be able to have the EA confirm "yes" or "no" to display for the EA.