i want to generate an RSA public public key file using openssl (or other tools) having public modulus and exponent, so i can use it later to encrypt files

i have this:

the modulus: 


the exponent: 0x10001

so how can i generate the public key from those, so i can use it to encrypt some data, or maybe there's a way to use these directly for encryption ?


closed as unclear what you're asking by Gilles, otus, yyyyyyy, Maarten Bodewes, Henrick Hellström Oct 1 '15 at 21:35

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ That is great you want to do that! What is your question? What have you tried? $\endgroup$ – mikeazo Sep 29 '15 at 12:09
  • $\begingroup$ i couldn't find anything, apparently i can do the inverse; getting the modulus and exponent form a public key $\endgroup$ – Issam Führer Sep 29 '15 at 12:40
  • 1
    $\begingroup$ What format is everything in right now? $\endgroup$ – mikeazo Sep 29 '15 at 12:54
  • $\begingroup$ When I need to do the same, I use a python module. Here you'll find the doc: dlitz.net/software/pycrypto/api/current/… You just need two integers (modulus and public exponent), then you export it with the RSA.export('PEM') function. (Give a look to the examples) $\endgroup$ – ddddavidee Sep 29 '15 at 13:12
  • $\begingroup$ thx that would help $\endgroup$ – Issam Führer Sep 29 '15 at 16:54

i got this, it's not with openssl, but python

e = 0x10001
N = 0x1234214....

words = open("words.txt").read().split()

for w in words:
     ww = int(w.encode("hex"), 16)
     print pow(ww, e, N) 

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