Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are computers deployed with a list of precomputed prime numbers

With my understanding of public key encryption, a server generates a public key from the product of two large prime numbers, p and q, to produce n.

n is then sent to the client that wishes to securely connect to the server.

The client picks a random number x and computes x^3 modulo n and passes this back to the server.

The server then calculates x from using p and q and then x is used as the private key to encrypt all traffic and both client and server know this without it ever being exposed.


Question

For each client that wants to connect to the server, the server needs to create a public key for each connection. On a busy server this would require the generation of many p's and q's.

Whilst computers are fast, if both p and q are large numbers within the range of 2^1024 determining whether these numbers are prime would take a lot of effort, and repeated effort if lots of connections are made to the server (thinking Google, Facebook etc.).

Also if the the random picking of p or q turn out to be non-prime, then the server will need to pick another random number and determine whether that number is prime. This looks like there might be quite a lot of wasted computational time.

So rather than the server having to compute two random primes, for each connection, can/does the server pick from a list of pre-computed primes that are installed on the server ? If so, can we trust these prime numbers are actually prime, and, picked randomly ?

like image 724
MrDeveloper Avatar asked Jan 01 '26 02:01

MrDeveloper


1 Answers

You misunderstand PKI, the server does not create a new public key for each client and connection.

Furthermore WRT creating RSA primes see the comments to the question by Rob Napier:

"generating large primes is not nearly as expensive as you likely think."
and his link generating large prime numbers for RSA.

like image 125
zaph Avatar answered Jan 02 '26 15:01

zaph