-1

I am doing a tutorial where my lecturer (PhD) gave me an optional question to do relating to RSA.

He said: write a python function that takes as input the server’s public key and then uses that to compute the server’s private key. Print out the server’s private key to standard out.

Because according to him, 16-bit or 17-bit keys can be easily factorized on your computers.

How am I able to do this. I have searched all over and people have said RSA private keys cannot be generated by public keys.

I am asking for guidance, please.

Jermaine Hall
  • 11
  • 1
  • 2

1 Answers1

-1

Take the server’s public key.

Parse the modulus and public exponent.

(A public key contains the public exponent and modulus)

Factor the modulus into p and q elements.

Calculate the private key as normal.

i.e.

1) calculate $$Carmichaels$$ $$totient:$$ $$\phi= lcm (p-1)(q-1) $$

2) calculate d the private key as $$d*e\equiv 1mod \phi$$

3) celebrate

Woodstock
  • 1,454
  • 1
  • 15
  • 26