Search code examples
javax509certificatebouncycastledigital-certificateverisign

How to submit the CSR to a certification authority Programatically?


I saw the code for creating a CSR using bouncy castle.

https://github.com/bcgit/bc-java/blob/master/misc/src/main/java/org/bouncycastle/jcajce/examples/PKCS12Example.java

How do I get this CSR authorized from a certification authority though? Can I choose to get it authorized from the company of my choice? If so, how can I do it through the code? Please advice.


Solution

  • I don't think there is a framework for doing this because signing requests varies from CA to CA. While the message (CSR) is the same for all, the protocol for submitting a CSR is (AFAIK) not specified. It's made more complicated by the fact that the CA needs proof that you own the domain you're trying to get a certificate for and by the fact that most CA's charge a fee for signing a certificate.

    If you choose a specific CA, you could create an automated process for that CA. For example if you use Let's Encrypt, they have a bunch of clients that you can use to submit CSRs programmatically.