I want to understand if there is a way to export a public key using any crypto methods, the way openssl is generating.

I am able to successful generate public key with the following command, however I want to automate a part - to create certificate and dynamically generate public key out of it and share with a team

openssl x509 -in SFDC2SUNSelfSigned2504.crt -inform pem -pubkey -noout > SFDC2SelfSigned2504.txt

I understand it is possible to create but, Is it possible to generate this key using apex (without manually executing openssl command from cmd prompt) ? If not apex, is there a way to automate this particular task to avoid manual step.

  • This sounds like a XY problem. What are you trying to achieve? There's probably an easier way to go about it.
    – identigral
    Commented Apr 25, 2021 at 19:58

1 Answer 1


Apex does not contain functionality for generating certificates or creating public/private key pairs.

You haven't provided any information about where or why you are seeking to automate this step, but it is certainly achievable using simple Bash scripts, which you can run in CI pipelines or scheduled jobs in your scheduler of choice.

You must log in to answer this question.

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