Anyone gotta quick and dirty way to collect a list of certificates from the System Keychain using a script / EA?
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>"
Thanks David! Seems to do the trick!
Slightly shorter way, but same principle:
security find-certificate -a /Library/Keychains/System.keychain | awk -F'"' '/alis/{print $4}'
@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.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.