I need to generate a 2048 bit key for ElGamal and I was looking for the $p$ and $q$ for PGP but I couldn't find them. the only thing I could find was this RFC but those are not safe primes.

Does anyone know where I can find those numbers?

  • $\begingroup$ select a uniform random prime, then multiply by 2 and add 1, finally test it for primeness, if not return the begin else, done. $\endgroup$
    – kelalaka
    Jan 24, 2020 at 8:30
  • 2
    $\begingroup$ Does this question help you How to efficiently generate a random safe prime of given length?, or this Efficient algorithm for finding Sophie Germain primes. Both are in the safe-prime tag. $\endgroup$
    – kelalaka
    Jan 24, 2020 at 8:41
  • $\begingroup$ it takes too long to generate a key of that size in a web client $\endgroup$
    – Jolo
    Jan 24, 2020 at 8:51
  • $\begingroup$ What is too long, what is short, what are the capabilities of the web client, etc...Isn't it a one time generation? $\endgroup$
    – kelalaka
    Jan 24, 2020 at 8:53
  • 2
    $\begingroup$ You don't need to generate a fresh group for each new key; the primes $p$ and $q$ need to be computed only once. If you're looking for some precomputed values, there is RFC3526 and RFC7919 appendix A, which both list only safe primes (hence $q = (p-1)/2$) $\endgroup$
    – poncho
    Jan 24, 2020 at 13:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy