Ok hunnies, solution to the riddle.
This is the way to decrypt INI files.
LEN, dane - buffer with data, and it's length
Use once to decrypt INI files. Use once again to encrypt it back. Kinda symmetric.
Have fun.
This is the way to decrypt INI files.
Code:
unsigned char dane[1024]; DWORD LEN = 1024; HCRYPTPROV hProvider = NULL; HCRYPTHASH hHash = NULL; HCRYPTKEY hKey = NULL; BOOL bRes; DWORD ddLen = LEN; bRes = CryptAcquireContext( &hProvider, NULL, MS_DEF_PROV, 1, 0xF0000000 ); bRes = CryptCreateHash( hProvider, CALG_MD5, NULL, NULL, &hHash ); bRes = CryptHashData( hHash, (BYTE *) "1111", 4, NULL ); bRes = CryptDeriveKey( hProvider, CALG_RC4, hHash, CRYPT_CREATE_SALT, &hKey); bRes = CryptDestroyHash( hHash ); bRes = CryptDecrypt( hKey, NULL, FALSE, NULL, dane, &LEN ); bRes = CryptDestroyKey( hKey );
Use once to decrypt INI files. Use once again to encrypt it back. Kinda symmetric.
Have fun.