Reputation: 31
I am trying to build a network involving multiple clients and a single server, both written in Java. I am trying to find a way to automatically generate a CSR on the client side that can be sent to the server for a signed certificate. I have been able to generate a public/private keypair in Java but cannot figure out how to generate a CSR. Maybe I am looking at doing this the wrong way! Please help!
Upvotes: 3
Views: 2976
Reputation: 12069
Take a look at the end of this article. It explains how to use the BouncyCastle libraries to generate both a certificate and a PKCS#10 CSR. This should be all you need to get this working.
Upvotes: 2
Reputation: 72059
You might want take a look at the Bouncy Castle Crypto APIs to help you generate a CSR. They have documentation on how to go about it. Here's an example that requires Bouncy Castle. I came across KeyUtils.java that has a writeCertReq()
method, however it depends on some internal sun.security
imports instead (so it'll be limited to the Oracle/Sun JVM). I'm actually not aware of a way to do it with the standard JCE.
Upvotes: 1