4

Possible Duplicate:
Generate certificates, public and private keys with Java

I want to generate private key and self signed certificate using Java code and export it into files. When I searched through net I am getting details only achieving through openssl or keytool commands, but not through java code. I would like not to use any third party library.

Below are the commands which creates key and self signed certificate, which I want to do the same using java code.

       openssl req -new -text -out server.req

       openssl rsa -in privkey.pem -out server.key

       openssl req -x509 -in server.req -text -key server.key -out server.crt

Any kind of help or suggestion will be really appreciated.

Community
  • 1
  • 1
Lolly
  • 34,250
  • 42
  • 115
  • 150
  • 2
    Have you looked at http://stackoverflow.com/questions/4634124/how-to-generate-sign-and-import-ssl-certificate-from-java?lq=1 and http://stackoverflow.com/questions/925377/generate-certificates-public-and-private-keys-with-java?rq=1 ? – user1890278 Dec 30 '12 at 18:59
  • I highly recommend using BouncyCastle (http://www.bouncycastle.org/latest_releases.html). – Pr0gr4mm3r Dec 30 '12 at 19:01
  • Have a look at this [page](http://www.mayrhofer.eu.org/create-x509-certs-in-java). – Codo Dec 30 '12 at 19:05
  • http://stackoverflow.com/questions/4634124/how-to-generate-sign-and-import-ssl-certificate-from-java?lq=1 – Lolly Jan 15 '13 at 18:47

0 Answers0