.Net KeyGen "Hardware ID is too long" exception, is it a bug ?

Issues related to VMProtect
jokehuang
Posts: 15
Joined: Mon Apr 22, 2019 8:09 am

.Net KeyGen "Hardware ID is too long" exception, is it a bug ?

Postby jokehuang » Wed May 15, 2019 6:56 pm

public String HardwareID
{
get { return strHardwareID; }
set
{
if (value != null)
{
byte[] b = Convert.FromBase64String(value);
if (b.Length == 0) throw new ArgumentException("Hardware ID has zero length, use 'null' instead");
if (b.Length > 32) throw new ArgumentException("Hardware ID is too long");
if (b.Length % 4 != 0) throw new ArgumentException("Hardware ID has invalid length");
}
strHardwareID = value;
}
}

1.png
1.png (29.47 KiB) Viewed 143 times


2.png
2.png (72.52 KiB) Viewed 143 times

Admin
Site Admin
Posts: 1624
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: .Net KeyGen "Hardware ID is too long" exception, is it a bug ?

Postby Admin » Sat May 18, 2019 12:43 pm

Try to change this line to the following code:

Code: Select all

if (b.Length > 255) throw new ArgumentException("Hardware ID is too long");