AndyDev
October 17th, 2004, 22:40
Hiya all,
I'm trying to reverse a VS.net component dll.
I was able to retrieve where the code stores the key (at the end of the dll with a MD5 signature aside, smart, eh?
)
I was able also to grab the function, which makes the validation of the key.
My problem is, that I'm having trouble reversing the algo.
If anyone could help me doing it, and of course explaining how, it will be a big help.
Small explanation about the function.
text1 stores the key.
The function calculates with the key, the expiration date of the DLL, I've found a key which expires at 1/27/2047, which I marked as a comment in the code.
The code is written in C#
Thanks all!
I'm trying to reverse a VS.net component dll.
I was able to retrieve where the code stores the key (at the end of the dll with a MD5 signature aside, smart, eh?

I was able also to grab the function, which makes the validation of the key.
My problem is, that I'm having trouble reversing the algo.
If anyone could help me doing it, and of course explaining how, it will be a big help.
Small explanation about the function.
text1 stores the key.
The function calculates with the key, the expiration date of the DLL, I've found a key which expires at 1/27/2047, which I marked as a comment in the code.
The code is written in C#
Code:
public static bool CheckLicense()
{
string text1 = KeyCheck.GetKey();
// text1="PRAP-6AA2A-E4T4R"; // This key will work for until 1/27/2047
int[] numArray1 = new int[0x10];
string text2 = "RVWX2AD3J4BC5KL6P7EF8MN9QUSGHTYZ-";
for (int num1 = 0; num1 < 0x10; num1++)
{
int num2 = text2.IndexOf(text1[num1]);
if (num2 < 0)
{
throw new KeyCheckException(KeyCheckExceptionStatus.InvalidKey);
}
if (((num2 == 0x20) && (num1 != 4)) && (num1 != 10))
{
throw new KeyCheckException(KeyCheckExceptionStatus.InvalidKey);
}
numArray1[num1] = num2;
}
int num3 = ((numArray1[0] << 10) + ((0x1f - numArray1[14]) << 5)) + (0x1f - numArray1[8]);
int num4 = ((numArray1[1] << 10) + (numArray1[5] << 5)) + numArray1[11];
int num5 = (((0x1f - numArray1[3]) << 10) + (numArray1[13] << 5)) + numArray1[12];
int num6 = ((numArray1[7] << 10) + ((0x1f - numArray1[9]) << 5)) + numArray1[2];
if (numArray1[6] != ((num3 >> 7) & 0x1f))
{
throw new KeyCheckException(KeyCheckExceptionStatus.InvalidKey);
}
if (numArray1[15] != ((num4 >> 9) & 0x1f))
{
throw new KeyCheckException(KeyCheckExceptionStatus.InvalidKey);
}
int num7 = ((num4 & 0x7e00) >> 9) + ((num4 & 0x1ff) << 6);
num6 ^= num3;
num5 ^= num7;
num3 ^= num4;
if (num3 != num5)
{
throw new KeyCheckException(KeyCheckExceptionStatus.InvalidKey);
}
DateTime time3 = new DateTime(2000, 1, 1);
DateTime time1 = time3.AddDays((double) num3);
return (DateTime.Now < time1);
}
Thanks all!