Certificates via Shell or KeyChain module

Is it somehow possible to get my Developer ID Certificate via a shell command or via the System.Keychain module?

I tried but no success so far.

What I try to do is making a simple code signing app. I can find the certificate in Apple’s Keychain application.
But I would rather find the keychain name programmatically.

Any suggestions?

The easiest way is to use a Shell to execute your the command and tell the keychain that your app doesn’t need a password to use the certificate.

I don’t think I fully understand you.

When you run the shell command macOS will popup a dialog box requesting your approval. In this dialog click the Always button.

I’ll give you some pointers, enough to go figure out what you need, but by no means enough to copy and paste as you’re creating a competitor to App Wrapper and some of this stuff, took years for me to figure out.

You need to use declares (or MBS) to read the code signing identities from the Keychain, you can search for valid identities and get returned an object from which you can then extract the code signing certificate and from that you can get the display name.

You do NOT want to search the keychain for certificates, as certificates alone is false information. To be able to code sign you need more than just a certificate, which is where identities come in.