Assume I wanted to generate an RSA key pair, and create a backup of it. It is possible to back up the randomness source used to generate the keypair instead of the keypair itself and still recover the keys if needed? Is this a secure practice? Are there any benefits or downsides when compared to backing up the keys themselves? Are the answers different if instead of RSA, I used a different scheme like ECDSA?

  • 1
    The source and quality of entropy has been a concern in cryptography for decades. However, if you could backup your source of entropy and recreate your keypair, then you do not have a secure system or keypair. Yes, it is possible, but you are more likely to discover life on the planet Mars first. Jun 28, 2023 at 21:14
  • 1
    Of course you can backup the seed used to generate a key pair (unless key generation is implemented entirely in hardware, then this will be difficult). The operating system and/or the cryptographic tool gather entropy from some source(s) and then use it to seed a purely deterministic algorithm for generating random numbers. At this point, you can capture and store the seed. Depending on the tool, it may also be possibly to set the entropy yourself, so that you don't have to patch the key generation.
    – Ja1024
    Jun 28, 2023 at 21:58

1 Answer 1


The seed of the randomness generator alone isn't sufficient to reconstruct the key. You'd also have to know the exact code which produced the key, because every tool and even different versions of the same tool can behave differently. For example, if you generated a key several years ago, the seed won't help you much today. To reconstruct the key, you'll need the exact same tool with the exact same version as before.

So while this backup technique is technically possible, it's extremely brittle, because you cannot restore the backup without specific code. You'll either have to store the entire code together with the seed (which is much bigger and more complex than a simple RSA key pair), or your backup will be highly susceptible to technology rot, because the tools and their versions we use today will all be obsolete in a few years.

Simply backup the encrypted private key.

  • 1
    Also in practice any PRNG that lets you extract a seed shouldn't be used for key generation at all! In theory it is of course possible to do so with a pure-software secure PRNG (at least prior to key generation) - if you make sure nothing drained or fed the PRNG state between seed capture and key gen - but the entropy state ("seed") might be larger than the keypair anyhow. If you use anything where drawing a few kilobits out of the [P]RNG causes the state to update itself - such as from the hardware RNG built into modern CPUs - you probably actually just can't back it up.
    – CBHacking
    Jun 29, 2023 at 7:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .