When picking an ephemeral Diffie-Hellman private key (little a or little b), can I reasonably just pick 32 random bytes? I am specifically interested in use within SRPv6.
RFC5054 says that these ephemeral keys are "a random number that SHOULD be at least 256 bits in length."
X9.42 requires that requires that the private key x be in the interval [2, (q - 2)]. x should be randomly generated in this interval.
(where q is (N-1)/2.)
Goals and concerns
It would be nice to just get a bunch of random bytes and make those into a big integer than to have to uniformly pick a big integer within a specific range.
Question updates following comments
When rfc2631 was first published (1999) DH groups were very small my todays (2017) standards. I am using the 4096-bit group from Appendix A of rfc5054, which means that q is a 4095-bit number. So if I shorten the range to a whole number of bytes, I would need to get 511 random bytes (4088 bits). That is an enormous amount of entropy to be asking.
As noted in a comment, picking a number uniformly in a range (that isn't a whole number of bytes) means addressing the modulo bias. I would much prefer to not try to deal with the modulo bias and so just pick a whole number of bytes.
Related questions (and answers)
My question is related to – but distinct from – Diffie-Hellman secret key choices, which is asking about some very specific values of generated keys.