I'm going to give a small talk on the mathematical background of RSA. My audience will consist mostly of software engineers and to make the mathematical stuff tangible, I wanted to demonstrate how to calculate the private key from the public key and the modulus in some reasonably realistic scenario.

What I was planning to do is to set up a simple server (Spring Boot inside Docker) which has one POST-endpoint and this endpoint should only be accessible via https.

Then I wanted to use tcpdump to capture the communication between some client and this server. Since I want to be able to decrypt this communication, I want the key exchange between client and server to be performed over RSA with the modulus so small that it can be easily factorized.

However, I fail in creating a (self signed) server certificate with decryptable RSA because the tools I know all require the primes to have some minimum size.

Does anyone know some good way to create such a certificate? Or, maybe, has someone already set up a similar scenario?

  • 1
    $\begingroup$ Instead of using a small modulus - can you use a normal size modulus, that is the product of primes that you know? $\endgroup$
    – mti2935
    Mar 11 '20 at 9:16
  • $\begingroup$ Hm yes. That would be an idea. Thanks for the hint. I will give it a try $\endgroup$
    – Bruno Krams
    Mar 11 '20 at 9:46
  • $\begingroup$ Also try first presenting the math with very small example numbers, such as two digits. It helps show how it works, without explaining the security. Follow it with an explanation so people see that breaking the security comes from being able to factor the product, which leads into a key size discussion. $\endgroup$ Mar 11 '20 at 13:20

Does anyone know some good way to create such a certificate?

As you need to put the private key on the server anyways, you could just copy it of and use that for demonstration purposes.

Alternatively you could use software versions from the time when such keylength restrictions were not in place.

In particular you might want to take a look at FREAK, in particular this website (need to scroll down a bit) has a list of vulnerable server and client software that you should be able to retrieve from release archives for demonstration purposes.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.