Skip to main content
Solved

Ext. Attribute To List Certificates


Forum|alt.badge.img+14
  • Honored Contributor
  • 351 replies

Anyone gotta quick and dirty way to collect a list of certificates from the System Keychain using a script / EA?

Best answer by davidacland

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>"
View original
Did this topic help you find an answer to your question?

4 replies

davidacland
Forum|alt.badge.img+18
  • Valued Contributor
  • 1811 replies
  • Answer
  • December 30, 2015

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>"

Forum|alt.badge.img+14
  • Author
  • Honored Contributor
  • 351 replies
  • January 4, 2016

Thanks David! Seems to do the trick!


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 4, 2016

Slightly shorter way, but same principle:

security find-certificate -a /Library/Keychains/System.keychain | awk -F'"' '/alis/{print $4}'

Forum|alt.badge.img+8
  • Contributor
  • 34 replies
  • November 2, 2017

@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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings