NAME
RSAgeneratekey - generate RSA key pair
SYNOPSIS
#include
RSA *RSAgeneratekey(int num, unsigned long e, void (*callback)(int,int,void *), void *cbarg);DESCRIPTION
RSAgeneratekey() generates a key pair and returns it in a newlyallocated RRSSAA structure. The pseudo-random number generator must be
seeded prior to calling RSAgeneratekey(). The modulus size will be nnuumm bits, and the public exponent will be ee. Key sizes with nnuumm < 1024 should be considered insecure. The exponent is an odd number, typically 3, 17 or 65537. A callback function may be used to provide feedback about the progress of the key generation. If ccaallllbbaacckk is not NNUULLLL, it will be called as follows: +o While a random prime number is generated, it is called as described in BNgenerateprime(3).+o When the n-th randomly generated prime is rejected as not suitable
for the key, ccaallllbbaacckk((22,, nn,, ccbbaarrgg)) is called.+o When a random p has been found with p-1 relatively prime to ee, it
is called as ccaallllbbaacckk((33,, 00,, ccbbaarrgg)). The process is then repeated for prime q with ccaallllbbaacckk((33,, 11,, ccbbaarrgg)). RREETTUURRNN VVAALLUUEE If key generation fails, RSAgeneratekey() returns NNUULLLL; the error codes can be obtained by ERRgeterror(3).BUGS
ccaallllbbaacckk((22,, xx,, ccbbaarrgg)) is used with two different meanings. RSAgeneratekey() goes into an infinite loop for illegal input values.SEE ALSO
ERRgeterror(3), rand(3), rsa(3), RSAfree(3) HISTORY The ccbbaarrgg argument was added in SSLeay 0.9.0.0.9.7l 2002-09-25 RSAgeneratekey(3)