How do you specify the key size of a Certificate Signing Request?

I'm trying to generate a CSR with godaddy. I used the following commands to create the certificate:

openssl req -new -nodes -keyout server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

But when I use the key generated in my server.csr file, I get the following error from godaddy:

The CSR key length must be 2048 or 4096

How do I specify the key size of the CSR?

P.S. I'm intending to use this on a domain hosted on heroku.


This should work for you:

openssl req -new -newkey rsa:2048 -keyout your.key -out your.csr

-newkey rsa:size - type and size of the private key


The way i prefer to do this is to edit the openssl.cfg and change the "default_bits" to "2048". In this way all keys you create will automatically start at the right size