資源簡介
Google Chrome Portable (免安裝) 63.0.3239.108
支持 Win 7、Win 8、Win 10
代碼片段和文件信息
#include?
#include?
#include?
#include?“sqlite.h“
byte*?EncryptPassword(byte*?blob?DWORD*?size?const?char*?masterPassword?const?char*?salt?HWND?hwndParent)?{
??HCRYPTPROV?csp?=?NULL;
??HCRYPTHASH?hash?=?NULL;
??HCRYPTKEY?key?=?NULL;
??if?(!CryptAcquireContext(&csp?NULL?MS_STRONG_PROV?PROV_RSA_FULL?0))?{
????if?(!CryptAcquireContext(&csp?NULL?MS_STRONG_PROV?PROV_RSA_FULL?CRYPT_NEWKEYSET))?{
????MessageBoxA(hwndParent?“Could?not?create?key?container!“?“ChromePasswords“?MB_IConerror);
??????return?NULL;
????}
??}
??if?(!CryptCreateHash(csp?CALG_SHA1?0?0?&hash))?{
??MessageBoxA(hwndParent?“Could?not?create?hash?object!“?“ChromePasswords“?MB_IConerror);
????CryptReleaseContext(csp?0);
????return?NULL;
??}
??int?passLength?=?strlen(masterPassword)?+?strlen(salt)?+?1;
??char?*?saltedPassword?=?new?char[passLength];
??strcpy_s(saltedPassword?passLength?salt);
??strcpy_s(saltedPassword?+?strlen(salt)?strlen(masterPassword)?+?1?masterPassword);
??if?(!CryptHashData(hash?(byte*)saltedPassword?passLength?0))?{
??MessageBoxA(hwndParent?“Could?not?hash?password!“?“ChromePasswords“?MB_IConerror);
????SecureZeroMemory(saltedPassword?passLength);
????delete[]?saltedPassword;
????CryptDestroyHash(hash);
????CryptReleaseContext(csp?0);
????return?NULL;
??}
??SecureZeroMemory(saltedPassword?passLength);
??delete[]?saltedPassword;
??if?(!CryptDeriveKey(csp?CALG_RC4?hash?CRYPT_EXPORTABLE?&key))?{
??MessageBoxA(hwndParent?“Could?not?derive?key?from?hash!“?“ChromePasswords“?MB_IConerror);
????CryptDestroyHash(hash);
????CryptReleaseContext(csp?0);
????return?NULL;
??}
??DWORD?encSize?=?*size;
??if?(!CryptEncrypt(key?NULL?TRUE?0?NULL?&encSize?encSize))?{
??MessageBoxA(hwndParent?“Could?not?get?the?size?of?the?encrypted?password!“?“ChromePasswords“?MB_IConerror);
????CryptDestroyKey(key);
????CryptDestroyHash(hash);
????CryptReleaseContext(csp?0);
????return?NULL;
??}
??byte*?text?=?new?byte[encSize];
??memcpy(text?blob?*size);
??if?(!CryptEncrypt(key?NULL?TRUE?0?text?size?encSize))?{
??MessageBoxA(hwndParent?“Could?not?encrypt?the?password!“?“ChromePasswords“?MB_IConerror);
????delete[]?text;
????CryptDestroyKey(key);
????CryptDestroyHash(hash);
????CryptReleaseContext(csp?0);
????return?NULL;
??}
??CryptDestroyKey(key);
??CryptDestroyHash(hash);
??CryptReleaseContext(csp?0);
??return?text;
}
byte*?DecryptPassword(byte*?blob?DWORD*?size?const?char*?masterPassword?const?char*?salt?HWND?hwndParent)?{
??HCRYPTPROV?csp?=?NULL;
??HCRYPTHASH?hash?=?NULL;
??HCRYPTKEY?key?=?NULL;
??if?(!CryptAcquireContext(&csp?NULL?MS_STRONG_PROV?PROV_RSA_FULL?0))?{
????if?(!CryptAcquireContext(&csp?NULL?MS_STRONG_PROV?PROV_RSA_FULL?CRYPT_NEWKEYSET))?{
????MessageBoxA(hwndParent?“Could?not?create?key?container!“?“ChromePasswords“?MB_IConerror);
??????return?NULL;
???
評(píng)論
共有 條評(píng)論