Page 1 of 1

VMProtectDecryptString how to use ?

Posted: Sat Sep 11, 2021 9:24 am
by tested05

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?

Re: VMProtectDecryptString how to use ?

Posted: Sat Sep 11, 2021 9:39 am
by Admin
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.