I use Crypto class to sign some data with certificate. The method signWithCertificate(algorithmName, input, certDevName) uses the certificate name.

Now I am coding the admin page which will allow admin select one of the certificates from the key store.

Is there a way to retrieve list of certificate names? Is there an API to work with keystore? Is it possible to soql query for certificate names?

1 Answer 1


As far as I can tell, there is no way to query the available certificates in Apex, the Partner API, or the Tooling API.

They are exposed in the Metadata API, but don't seem to have a field that corresponds to the developer name for the certificate. The masterLabel is most likely the value you need. You might be able to use the Apex Wrapper Salesforce Metadata API with a listMetadata API call and type_x of certs.

For what it's worth, certificates have the keyprefix 0P1. You could potentially screen scrape them from /0P1. I'd avoid this if you can, as it would be very prone to breaking.

  • Pump the brakes! Brittle solution prone to braking! Haha.
    – Adrian Larson
    Commented Oct 26, 2016 at 20:54
  • 1
    @AdrianLarson Ha, you got me :). Screen scraping could certainly slow you down like brakes. I'm trying to figure out how "Braking Changes" would relate "Breaking Changes." Commented Oct 26, 2016 at 21:17
  • 1
    If Metadata API can do this, then there is probably a way to query it from Metadata tables. Thanks for the hint with type_x=certs, will give it a try
    – Pavlonator
    Commented Oct 27, 2016 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .