VMProtectDecryptString how to use ?

Issues related to VMProtect
tested05
Posts: 5
Joined: Fri Dec 15, 2017 4:14 pm

VMProtectDecryptString how to use ?

Postby tested05 » Sat Sep 11, 2021 9:24 am

Code: Select all

         if (aSizeEncrypted)
         {
            DWORD aSizeDataEncrypted = aSizeEncrypted;
            LPSTR aDataEncryptedString = (LPSTR)malloc(aSizeEncrypted);
            memcpy(aDataEncryptedString, (LPBYTE)aBuffer + hdrsz, aSizeEncrypted);
            CryptAES(aDataEncryptedString, aSizeEncrypted, pwd, false);
            aDataEncrypted = (BYTE*)malloc(aSizeDataEncrypted);
            CryptStringToBinaryA(aDataEncryptedString, NULL, CRYPT_STRING_BASE64, aDataEncrypted, &aSizeEncrypted, NULL, NULL);
            free(aDataEncryptedString);
            if (aSizeDeCompressed == aSizeCompressed)
            {
               memcpy(aDataBuf, aDataEncrypted, aSizeDeCompressed);
               free(aDataEncrypted);
               return aSizeDeCompressed;
            }
         }


How can I protect SizeDeCompressed variable with VMProtectDecryptString?

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

Re: VMProtectDecryptString how to use ?

Postby Admin » Sat Sep 11, 2021 9:39 am

Please notice that VMProtectDecryptString works for string literals only:

Code: Select all

char *str = VMProtectDecryptStringA("MY SECURE STRING");

And it removes "MY SECURE STRING" from binary file while protection.