I have problems implementing asymmetric encryption to generate product keys for my application.
Steps are:

  • I create a file with a code inside (a series of characters), depending on random, on windows product key and on the volume”where windows is installed” serial number
  • The public key encrypts that code
  • The user sends me the code
  • I decrypt it and do what I need, to give a product key feedback (we will call this part as AZ)
  • I encrypt that with my private key and send it back to the customer/user
  • The user can/want to insert that product key in the application (via dialog input) and the application decrypts it and checks if it fits what it needs to fit.

My goals/problems to solve are:

1.If it is so simple for a “not novice” to open my application and read its code as I’ve been told, then it’s also simple to see what are the public key and formula to decrypt the product key I give the user, as in the code there’s clearly written what kind of “product key” the application is expecting. I mean, there’s stated the passage AZ used to define which value or input is expected as proper product key;

Imagine you want the user to input “16” because his “application ID” is “8” and the formula for the product key wants that “product key the user inputs = ID * 2”, if one reads the code he just knows he has to input the proper number according his ID (which he can know if he knows where to search, so he knows he will have to write “16”).

So what’s the point in using asymmetric encryption, when in the code there’s still track of what is the expected input and even when you can produce yourself that result using multiple times your public key (tested myself: I went with X ^ Y % Z, result ^ Y % Z, result ^ Y % Z, I got X)?

2.I followed tutorials which explain usually to have your pair of keys you should use large prime numbers (and thus also related great key values); now, I’m working on WinForms with C#, but even using the double class to store the values, when the formula gets to “(number ^ key) % X” (being X the product of 2 prime numbers, theoretically also large numbers), you cannot calculate that, because if you try even to calculate 2 ^ 65 it’s a too large number and cannot be calculated. In fact, to test asymmetric encryption i had to use values very far away to what i call “large numbers”.

Maybe (probably?) I’m missing something or “large prime numbers” doesn’t fit my idea of it, for me “great numbers” are surely over 1k and possibly over 1kk…Am I missing something about this or even about calculating very large numbers?