sid3k
sid3k

Reputation: 225

How can I create a RSA public key in PEM format from an RSA modulus?

I have the modulus of an RSA public key. I want to use this public key with the Python library "M2Crypto", but it requires a public key in PEM format.

Thus, I have to convert the RSA modulus to a PEM file.

The modulus can be found here.

Any ideas?

Upvotes: 2

Views: 6475

Answers (1)

erickson
erickson

Reputation: 269857

The M2Crypto library has a way to reconstruct a public key. You need to know the public exponent, e (often 65337 for RSA keys, but other numbers such as 3 or 17 have been used), and the modulus, n (which is the 512-bit number provided in the question). Note that the docs describe the length-encoded format used for e and n.

Once the public key has been reconstructed, it can be saved into a file and used again later without the hassle of conversion.

Upvotes: 4

Related Questions