Question: Generate suitable random integer

Coding in key generation of RSA Cryptosystem

message :=123456;

u := nextprime(RandomTools[Generate](integer(range = 10^100 .. 10^(110-1))));

v := nextprime(RandomTools[Generate](integer(range = 10^100 .. 10^(110-1))));

N := u*v;

phi := (u-1)*(v-1);

In RSA cryptosystem, the encryption or decryption of message only can be existed between range 1<=message<=N. This means that if the value of message bigger than N value then we can't get back the original value when performing decryption.Thus, wanna to ask that how can we create a coding so that the system will recognise the random integer u and v whether lie between range 1<=message<=N, means wanna crete a coding that if  N>=message then it will continue to the phi step whereas if message>=then the system need to regenerate the u and v until it satisfy the condition  1<=message<=N .Thus please help as i am a beginner in Maple.Thanks.

Please Wait...