32

I'm trying to figure out how to install .csr certificate under Windows but probably the only way is to convert it to some other format (maybe with openssl) but I have no idea how.

Do you have any suggestion?

martin
  • 93,354
  • 25
  • 191
  • 226

1 Answers1

75

CSR file is the Certificate Signing Request. It contains the information which is needed to generate a certificate based on your private key and information about the WebSite.

CER is the certificate itself (which you install into your Web browser). There is basically no way to convert directly from one to another as you need a key to sign the certificate, but what can do is to generate a self-signed certificate (e.g. certificate signed by the same key which was used to generate it):

openssl x509 -req -in server.csr -signkey server.key -out server.crt
dma_k
  • 10,431
  • 16
  • 76
  • 128
  • I have a .csr file and I have generated .crt file as well I have a private key as well.Can you please guide me how to use them in java providing some java example.it will be highly appreciated. – Ali Oct 30 '14 at 07:04
  • 1
    Have a look at [How to use .key and .crt file in java](http://stackoverflow.com/questions/6482484/how-to-use-key-and-crt-file-in-java-that-generated-by-openssl). – dma_k Mar 05 '15 at 11:17
  • In the original post, the author didn't have a private key, but you assume one exist in the command you posted (server.key). Would you generate that key using OpenSSL too? Would you mind sharing the command you'd use for creating that private key? – Kappacake Mar 06 '18 at 11:48
  • What if you also need to include a root certificate in the new certificate? – Kappacake Mar 06 '18 at 11:49
  • 2
    @demonicdaron ```openssl.exe genrsa -out .key 4096``` to generate a key. 4096 is the bit-length that is used to generate the key. – bucky Jul 26 '19 at 12:45