Given a RSA 1024 bit private key, how can I make OpenSSL generate the 2048 bit version of the same key?

(Additionally: Do the same thing, but with public keys)


Short answer: You can't.

A key of a different length is an entirely different key, bearing no relation to any other key of any other length. A 1024-bit key is a 1024-bit key, and there is no 2048-bit (or 512-bit or any other size) version of it.

If you want to use a longer key, you need to generate a longer key and use that instead of the shorter key.

Not the answer you're looking for? Browse other questions tagged or ask your own question.