I'm new to security and crpyto,
I know that Public/Private keys are generated in a different way depending on the used algorithm,
But let's take RSA as an instance (Using prime numbers),
Does the algorithm generate keys randomly or in a structured way?
I mean if I asked for a public/private key, would the algorithm:
- Generate random prime numbers and then generate from them the Public/Private key? OR
- It has for example a database that contains all of the keys that it has generated before, and then compares new keys to them to avoid collision?
OR how can it ensure that that generated public/private key has been never generated before?