How to retrieve UID value from certificate retrieved from keychain in Mac

I have a Mac application.


In this app, I have a requirement to retrieve certificate data (common name, UID) from the certificates retrieved from keychain.

I managed to retrieve common name using method SecCertificateCopyCommonName.


Can anyone please guide me how to retrieve UID from certificate data?