9

I'm trying to retrieve the certificate expiration date an application using the codesign command line tool, but I cannot seem to find the date that the certificate will expire. Any ideas?

Nick Bitzer
  • 93
  • 1
  • 3

2 Answers2

14

Use codesign to extract the certificates to the current directory:

codesign --display --extract-certificates /Applications/Example.app

You can then use Quick Look to view them:

qlmanage -c public.x509-certificate -p codesign*
Matt Stevens
  • 13,093
  • 3
  • 33
  • 27
  • this was an awesome response! – Chris Oct 21 '14 at 00:39
  • Does not work now for me on Mojave, nevertheless, after extracting, and creating a temporary keychain in Keychain Access.app, and dropping the extracted cert in it, I can view what I need. – Zsolt Szatmari Nov 22 '18 at 11:13
5

The selected answer did not quite work for me, but a slight variation found here using openssl did the trick. In short,

codesign -dvvvv --extract-certificates /Applications/Example.app

openssl x509 -inform DER -in codesign0 -text
Julien Chastang
  • 17,592
  • 12
  • 63
  • 89
  • This one worked. The "qlmanage" one didn't work on my system. Perhaps it's different because my workstation didn't have the certificate installed, but using openssl, I apparently didn't need that. – macetw Jul 15 '19 at 23:35