I'm working on integrating salesforce instances with an external service that I control and we're currently evaluating using JWTs to authenticate. If I have a certificate in the Certificate and Key management store it's pretty easy to generate the JWT, but I'm struggling with bootstrapping the process.
I could have someone go into their instance and click the Generate self-signed certificate button, but I'm trying to automate it. My question is how do I programmatically generate a self-signed certificate and add it to the Certificate and Key Management store? Alternatively we are looking at setting up our own CA and issuing the certificate, in which case I'd need a way to programmatically import a signed certificate into the key store.