Hello,
I have some questions about KeyGenExample for MSVC. I'm using the VMProtect Ultimate demo because I want to use hardwareIDs to lock down my program to the user's machine.
The KeyGenExample example requires me to fill in the g_Algorithm header block.
I only want to use the user name and hardware ID fields to generate a key.
When I run VMProtect.exe and try to create a new license, I check:
- Customer Name (leave empty)
- Hardware ID (leave empty)
However, I can't create it because I get an error message:
"Hardware ID is invalid or empty."
If I leave the HWID field unchecked, I can export this data using the "Export Key Pair" button.
This data is then copied to the g_Algorithm header block.
Now, this is what I don't understand.
Why am I required to enter hardwareID information when creating a new license?
This setup confuses me.
This is what I want do. I want to create a single keygen for all users.
Users submit their name and hardwareID, and the keygen generates their key.
But, how am I suppose to do that if I can't leave both customer name and harwardID fields blank when creating new license data for keygen?
I hope you understand.
KeyGenExample questions
Re: KeyGenExample questions
Did you try an example from %VMProtect%\Keygen\DLL\Example_MSVC?
This example shows all required steps that you need to do:
1. You need to export your key pair from VMP project (Licenses - Export Key Pair) into KeyGenExample.cpp:
That's all.
This example shows all required steps that you need to do:
1. You need to export your key pair from VMP project (Licenses - Export Key Pair) into KeyGenExample.cpp:
2. For creation a license you need to fill required fields in the structure VMProtectSerialNumberInfo:#include "stdafx.h"
//////////////////////////////////////////////////////////////////////////
// !!! this block should be generated by VMProtect License Manager !!! ///
//////////////////////////////////////////////////////////////////////////
VMProtectAlgorithms g_Algorithm = ALGORITHM_RSA;
size_t g_nBits = 0;
byte g_vModulus[1];
byte g_vPrivate[1];
byte g_vProductCode[1];
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
So if you need to lock a license by HarwareID you need add flag "HAS_HARDWARE_ID" into "si.flags" and specify HardwareID in the field "si.pHardwareID"VMProtectSerialNumberInfo si = {0};
si.flags = HAS_USER_NAME | HAS_EMAIL;
si.pUserName = L"John Doe";
si.pEMail = L"john@doe.com";
char *pBuf = NULL;
VMProtectErrors res = VMProtectGenerateSerialNumber(&pi, &si, &pBuf);
if (res == ALL_RIGHT)
{
printf("Serial number:\n%s\n", pBuf);
VMProtectFreeSerialNumberMemory(pBuf);
}
else
{
printf("Error: %d\n", res);
}
That's all.
Re: KeyGenExample questions
Yes, that's the example I'm working with.Did you try an example from %VMProtect%\Keygen\DLL\Example_MSVC?
But, this is what I still don't understand.
When creating a new license in the VMP project, is it required for me to check these options under "Serial Number Content" ?
- Customer Name
- Hardware ID
Can I leave all of these options unchecked?
Can I also leave all of the "License Details" fields empty?
In the KeyGemExample.cpp, I'm using these flags:
Code: Select all
VMProtectSerialNumberInfo si = {0};
si.flags = HAS_USER_NAME | HAS_HARDWARE_ID;
Re: KeyGenExample questions
These options are not checks. They mean that the serial number will contain fields "Customer Name" and "Hardware ID". If a serial number contains "Hardware ID" VMProtect automatically checks it in VMProtectSetSerialNumber. Other fileds you can get with VMProtectGetSerialNumberData.Does this mean I have to check those options (Customer Name, Hardware ID) in the VMP project, for the keygen flags to work?
Re: KeyGenExample questions
BTW, I don't intend to use the licensing system. I just need to create a single keygen for all of my users.
In order to do this, I have to create a blank license to get the g_Algorithm header block data, so I can compile a keygen which can generate keys from user name and hardware ID.
I'm not sure if I'm doing this correctly or perhaps VMProtect doesn't meet my requirements.
In order to do this, I have to create a blank license to get the g_Algorithm header block data, so I can compile a keygen which can generate keys from user name and hardware ID.
I'm not sure if I'm doing this correctly or perhaps VMProtect doesn't meet my requirements.
Re: KeyGenExample questions
It seems that you don't understand what is the key pair
) It's not a blank license - it's just RSA keys!

Re: KeyGenExample questions
Ah, I see my mistake now. I don't have to create any licenses to export a key pair.
I assumed I had to create a blank license to enable that button.
I was confused because the key pair button is listed under "Licenses". I assumed the two were linked somehow.
Thanks
I assumed I had to create a blank license to enable that button.
I was confused because the key pair button is listed under "Licenses". I assumed the two were linked somehow.
Thanks