152.26 KB, 下载次数: 11
DLL命令名 | 返回值类型 | 公开 | 备 注 | |
CryptProtectData | 整数型 | |||
DLL库文件名: | ||||
crypt32.dll | ||||
在DLL库中对应命令名: | ||||
CryptProtectData | ||||
参数名 | 类 型 | 传址 | 数组 | 备 注 |
pDataIn | Blob | |||
szDataDescr | 字节集 | |||
Entrophy | 整数型 | |||
pvReserved | 整数型 | |||
pPromptStruct | 整数型 | |||
dwFlags | 整数型 | |||
pDataOut | Blob |
// Encrypt data from DATA_BLOB DataIn to DATA_BLOB DataOut.
//--------------------------------------------------------------------
// Declare and initialize variables.
DATA_BLOB DataIn;
DATA_BLOB DataOut;
BYTE *pbDataInput =(BYTE *)"Hello world of data protection.";
DWORD cbDataInput = strlen((char *)pbDataInput)+1;
//--------------------------------------------------------------------
// Initialize the DataIn structure.
DataIn.pbData = pbDataInput;
DataIn.cbData = cbDataInput;
//--------------------------------------------------------------------
// Begin protect phase. Note that the encryption key is created
// by the function and is not passed.
if(CryptProtectData(
&DataIn,
L"This is the description string.", // A description string
// to be included with the
// encrypted data.
NULL, // Optional entropy not used.
NULL, // Reserved.
NULL, // Pass NULL for the
// prompt structure.
0,
&DataOut))
{
printf("The encryption phase worked.\n");
LocalFree(DataOut.pbData);
}
else
{
printf("Encryption error using CryptProtectData.\n");
exit(1);
}
揰掵佲 发表于 2023-2-20 13:39
火山直接内嵌C++的代码即可[mw_shl_code=cpp,true]// Encrypt data from DATA_BLOB DataIn to DATA_BLOB Da ...
揰掵佲 发表于 2023-2-20 13:39
火山直接内嵌C++的代码即可[mw_shl_code=cpp,true]// Encrypt data from DATA_BLOB DataIn to DATA_BLOB Da ...
39.73 KB, 下载次数: 7
欢迎光临 精易论坛 (https://125.confly.eu.org/) | Powered by Discuz! X3.4 |