giozh
giozh

Reputation: 10068

RSA_generate_key() openssl: exp argument

I've found on internet that the exp argument of the function "is typically 3,17, or 65,537".

How I choose it, and what is the difference between using 3,17 and 65,537?

Upvotes: 1

Views: 704

Answers (3)

SquareRootOfTwentyThree
SquareRootOfTwentyThree

Reputation: 7766

I advise to stick to what NIST recommends today in SP 800-56B: the value 65'537 (in truth they recommend any odd positive integer no smaller than that).

The only reasons for choosing lower number (e.g. 3 or 17) are related to:

  • compatibility to existing systems that only support specific public exponents
  • performance issue when verifying a signature or encrypting a payload.

If those are valid concerns for you, you should consider lower exponents, but you should be aware that you become more sensitive to flaws in the RSA implementation.

Upvotes: 1

Jim Diamond
Jim Diamond

Reputation: 1274

Here is a good answer to your question: Should RSA public exponent be only in {3, 5, 17, 257 or 65537} due to security considerations?

And if you love math, you could also browse through this:

some math

Upvotes: 2

dwalter
dwalter

Reputation: 7468

You should choose your exponent so that it is relatively prime to p-1 for all primes p which divide the modulus. Although you may encounter problems with some libraries if you try to use other values than 3,5,17,257,65537 (Wikipedia offers more details on the RSA key-generation)

Here is a very good description on a related question.

Upvotes: 1

Related Questions