PDA

View Full Version : Finding RSA Constants for keygenning...


foxthree
April 11th, 2002, 20:33
Hi All:

I just unpacked a "famous" packer and analyzed its keygen scheme. It is using RSA. I'm pretty sure of this as it is using constants like A, E, D, N etc. in its keygen code.

My question here is that, if an application packed with this packer is shipped and uses the keygen mechanism provided by this packer for registering the software, then:

(1) What constants must be encoded into the binary so that I can fish it out for a keygen?
(2) What constants must be factored by me to complete the keygen?

BTW, i thought I knew RSA by heart, alas, that thought is short-lived after I reversed this code. I'm off to study RSA again but wanted your opinions on this one.

Signed,
-- Foxthree

Kythen
April 11th, 2002, 23:08
The constants E and N will be in the target in some form. You must factor N to get it's two prime factors P and Q. The decryption exponent D is calculated from P and Q using D = E^-1 % (P-1)(Q-1).

Hope that helps!
Kythen

mike
April 12th, 2002, 01:36
If you're not sure it's RSA, can you post what he's calculating?

foxthree
April 12th, 2002, 09:45
Hi Kythen:

Thanks for your post.

Mike: Yes, I will. Let me first complete my analysis.

Signed,
-- FoxThree