[Asm] 纯文本查看 复制代码 // Token: 0x06001F98 RID: 8088 RVA: 0x00559BC0 File Offset: 0x00557DC0
public static void ReadKey()
{
if (UsbKey.mUsbKey == null)
{
UsbKey usbKey = new UsbKey();
usbKey.Load();
UsbKey.mUsbKey = usbKey;
}
UsbKey usbKey2 = UsbKey.mUsbKey;
bool flag = usbKey2.OpenKeyEx();
try
{
byte[] array = new byte[512];
if (!usbKey2.Read(array, 0))
{
if (!flag)
{
throw new Exception("不能读USB加密狗或密钥不匹配1");
}
throw new Exception("不能读USB加密狗或密钥不匹配2");
}
else
{
uint num = (uint)((int)array[0] << 24 | (int)array[1] << 16 | (int)array[2] << 8 | (int)array[3]);
UsbKey.MgtUse = ((num & 4U) != 0U);
UsbKey.StdUI = ((num & 8U) != 0U);
byte[] array2 = new byte[16];
if (!usbKey2.GetSerial(array2))
{
throw new Exception("读取USB加密狗出错1");
}
int num2 = 4;
if (!UsbKey.CompareArray(array2, 0, array, num2, array2.Length))
{
throw new Exception("读取USB Key出错1");
}
if (!UsbKey.CompareArray(array2, 0, new byte[16], 0, array2.Length))
{
UsbKey.UsbSn = Convert.ToBase64String(array2);
}
UsbKey.DevSn = Convert.ToBase64String(array, num2, array2.Length);
if ((num & 1U) == 0U)
{
num2 = 20;
DateTime dateTime = Convert.ToDateTime(string.Format("{0:X2}{1:X2}-{2:X2}-{3:X2}", new object[]
{
array[num2],
array[num2 + 1],
array[num2 + 2],
array[num2 + 3]
}));
if (DateTime.Now > dateTime)
{
throw new Exception("系统已过期1!");
}
UsbKey.EndDate = dateTime;
}
num2 = 24;
UsbKey.ChnCnt = (int)array[num2];
if ((num & 2U) == 0U)
{
}
num2 = 121;
byte crc = CRC8.GetCRC8(array, 0, num2);
if (array[num2] != crc)
{
throw new Exception("读取USB Key出错2");
}
byte[] array3 = new byte[512];
if (!usbKey2.Read(array3, 1))
{
throw new Exception("不能读USB加密狗1");
}
UsbKey.IsOemUse = (array3[0] == 70 && array3[1] == 85 && array3[2] == 89 && array3[3] == 71);
if (UsbKey.<ReadKey>o__SiteContainere.<>p__Sitef == null)
{
UsbKey.<ReadKey>o__SiteContainere.<>p__Sitef = CallSite<Func<CallSite, object, bool>>.Create(Binder.UnaryOperation(CSharpBinderFlags.None, 83, typeof(UsbKey), new CSharpArgumentInfo[]
{
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
}));
}
if (UsbKey.<ReadKey>o__SiteContainere.<>p__Sitef.Target(UsbKey.<ReadKey>o__SiteContainere.<>p__Sitef, UsbKey.IsOemUse))
{
uint num3 = (uint)((int)array3[8] << 24 | (int)array3[9] << 16 | (int)array3[10] << 8 | (int)array3[11]);
UsbKey.OemKey = num3;
DateTime dateTime2 = new DateTime((int)(array3[12] * 100 + array3[13]), (int)array3[14], (int)array3[15]);
ushort num4 = (ushort)((int)array3[16] << 8 | (int)array3[17]);
UsbKey.OemEndDate = dateTime2;
UsbKey.OemTipDays = num4;
}
array3 = new byte[512];
if (!usbKey2.Read(array3, 2))
{
throw new Exception("不能读USB加密狗2");
}
bool flag2 = array3[0] == 70 && array3[1] == 85 && array3[2] == 89 && array3[3] == 71;
if (flag2)
{
uint num5 = (uint)((int)array3[4] << 24 | (int)array3[5] << 16 | (int)array3[6] << 8 | (int)array3[7]);
if (num5 > 0U)
{
UsbKey.OemFlag = num5;
if (num5 == 1U)
{
string [url=home.php?mod=space&uid=452487]@String[/url] = Encoding.UTF8.GetString(array3, 8, 32);
char[] trimChars = new char[1];
UsbKey.SoftPwd = @string.TrimEnd(trimChars);
}
if ((num5 & 3U) == 3U)
{
try
{
DateTime dateTime2 = new DateTime((int)(array3[40] * 100 + array3[41]), (int)array3[42], (int)array3[43]);
UsbKey.OemEndDate_NoUse = new DateTime?(dateTime2);
}
catch
{
}
}
}
}
array3 = new byte[512];
if (!usbKey2.Read(array3, 3))
{
throw new Exception("不能读USB加密狗3");
}
flag2 = (array3[0] == 70 && array3[1] == 85 && array3[2] == 89 && array3[3] == 71);
if (flag2)
{
uint num5 = (uint)((int)array3[4] << 24 | (int)array3[5] << 16 | (int)array3[6] << 8 | (int)array3[7]);
if (num5 > 0U)
{
UsbKey.OemFlag = num5;
if (num5 == 4U)
{
string string2 = Encoding.UTF8.GetString(array3, 8, 32);
char[] trimChars = new char[1];
UsbKey.SoftPwd_3 = string2.TrimEnd(trimChars);
}
}
}
}
}
finally
{
usbKey2.CloseKey();
}
} |