I am trying to create a program for the RSA algorithm. I have managed to get the public keys, but I hit a brick wall trying to figure out how to generate the secret key. I have tried, but the output is either incorrect or doesn't output at all. my program for the secret key is
d=1;
while (d!=(1/e)%phi)
{
d++;
}
where d is the secret key, e is the relatively prime number to phi, phi being (p-1)*(q-1), where p and q are the two primes.
can anyone tell me what's wrong?