What is the function that returns the private key?

40 Views Asked by At

What is the function that returns the private key d if I know:

  1. The Two primes numbers (q, p)
  2. a selected public key e.

In an RSA algorithm?

1

There are 1 best solutions below

0
On

In RSA, $d$ must be the inverse of $e$ modulo $(p-1)(q-1)$. Various algorithms to compute modular inverses exist; the most common one is a simple extension of Euclid's algorithm for computing the greatest common divisor of $e$ and $(p-1)(q-1)$.

There are code examples to be found here.